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
- I have a my_app.db database
- I make modifications on the rows, tables, etc. of the my_app.db
- I save the modified my_app.db as my_app_v2.db ( and so on )
- I replace the my_app.db file of the assets folder with the my_app_v2.db and set it as the default database
- I compile and run the program using the newly created my_app_v2.db
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.