I have an Android app that uses a SQLite database and Active Android as ORM. On each app update I need to ship my database with new/updated data. This is what i've been doing
So when the user gets the app, it will be using the my_app_v2.db with new contents.
I know that Active Android supports migration scripts, but on each database update I need to add/update about 2000+ records. So for each database update I would need a migration script with 2000+ insert/update statements, it means that for 3+ consecutive upgrades the app would have to execute about 6000+ statements.
I want to know if my approach of replace the whole database with a new one is a bad practice and the migrations scripts should be prefered.
You dont need to do that (renaming stuff or anything)
You just need to change your database version and write a sql command to alter your previous table to migrate from version A to B.
Look at this link:
Android: upgrading DB version and adding new table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With