How to create Schema , run migrations #3136
-
There are two functions in Database.Schema I don't know when to run them (I've solved my problem partially) 1 - I still don't know when to run Schema.create , for now I am running Schema.create every time my app is started because 2 - I know I should track the version of the database using 3 - In the new version , 2.0.0-alpha02 of sqldelight is there a way , I can get the created row id Long , I know api changes have been made , Can I do this now ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
HOW TO GET THE current version of the database in Android context ! |
Beta Was this translation helpful? Give feedback.
-
Ok I got it , sorry for the question Saw the code here https://github.com/JakeWharton/dodo/blob/e64a6d12afcadba674a726cce37a1dd20414bf06/src/main/kotlin/com/jakewharton/dodo/db.kt#L27 |
Beta Was this translation helpful? Give feedback.
Ok I got it , sorry for the question
When the database version is 0 which should be by default , I should run
Schema.create
and set the database version to current schema versionand if database version is less than current schema version , I should migrate to current schema version
Saw the code here https://github.com/JakeWharton/dodo/blob/e64a6d12afcadba674a726cce37a1dd20414bf06/src/main/kotlin/com/jakewharton/dodo/db.kt#L27