samedi 14 mars 2015

update sqlite database for new and existing users

I have an app in Google's Play Store. The app uses a prepopulated sqlite database: MyDb.zip, located in the assets folder. I am using sqliteAssetHelper. Now, I want to upgrade the app by adding rows to existing tables. No change to schema. I do not want existing users to lose their data which is in the database. I have written a sql script(MyDb_upgrade_1-2.sql), placed in the assets folder, incremented the DATABASE_VERSION = 2. All works fine, MyDb is updated for existing users when their app is upgraded. But, new users who have just obtained the app, do not get the updated DB. The script does not run. How can I upgrade old users AND be sure new users get the upgraded version? I realize I could have 2 sql scripts, 1 for each group, but if that is the answer, I don't know how to name the 2 script files. Thanks for any help. Michael


Aucun commentaire:

Enregistrer un commentaire