Update a DB file
I've got a .db file that I use Titanium.Database.install() to load up. Loaded up my app (debugging on the phone) and it worked great.
As I continued developing my app it was apparent that I needed another column in my db table. So I added it, and hit install again. Updated app code made it to the device, but the new DB did not.
How can I get the updated DB to my app? This seems like a pretty common flow in the development process?
2 Answers
-
I found I was able to actually uninstall my app from my phone, then reinstall fresh and it grabbed the updated DB file.
-
Correct. Titanium.Database.install() only copies over the resource folder's version of the database in the case that the previous database does not exist. That way you can have a starter DB yet it still persists the user's data. In the case where you need to clear out the old DB, you're quite right to wipe the app and data and reinstall.
In the future, this may be something to keep an eye on. Not in the sense of Titanium, but in updating a database to a new layout, be it one new column or a rewrite.