What is the best practice for updating the DB schema? I could send a text file with the SQL commands. The app could check the text file and execute the commands needed. I am guessing then I will have a flag to indicate that the update has been done. I havent found a way to delete a file in the asset folder from the app, which would be the best thing to do after the DB was updated.
Any thoughts on this?
You will probably want to override
onUpdate(SQLiteDatabase db,int old Version,int newVerison)
The following tutorial can walk you through the process: http://www.codeproject.com/KB/android/AndroidSQLite.aspx
What is the best practice for updating the DB schema?
Use SQLiteOpenHelper
. The only time you will be updating your schema is when you update the application. Whether you have the SQL commands in a file that you read in or just in your Java code is up to you.
I am guessing then I will have a flag to indicate that the update has been done.
That is part of what SQLiteOpenHelper
gives you.
I havent found a way to delete a file in the asset folder from the app, which would be the best thing to do after the DB was updated.
That is not possible, sorry.
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