So I did a Release to my device. It is giving me an error that a field is missing. The field is present in the database file that included in my project. So can someone explain to me how this works? Shouldn't when I do a release and then an install that the database that is attached to my project get updated also?
So lets say that my app was finished and on the market. Lets say I had to make a change to the database. How would I update it? And how do I update the one on my phone now?
In simple terms, after updating/installing the app, check the DB on the device (you can check the number of columns, version, etc) if it matches the latest version, you are done, otherwise, modify the DB adding/removing the necessary columns.
There are samples posted in the forums, do a little research.
So can I delete the existing and then use the new one? It seems like it would be a lot easier if every time you installed it would overwrite the existing database with the new one.
Well, if the data is static then yes, the easiest way is to overwrite, but, if the user saves data to the database then it will be lost, it depends on your app.
FWIW, I actually build the database on the device on the first install of the app (I don't distribute the DB in the apk), then on every startup of the app I run a validation routine. That way if I make any structural changes to the DB (eg: add or drop a table, add a field to a table, etc...) the validation routine makes the required changes & brings the DB up to date without deleting any of the user's data.