Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked October 6th 2010 by Anthony Webb
  • database
  • db
  • reload
0 Comments

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.

    — answered October 6th 2010 by Anthony Webb
    permalink
    1 Comment
    • You can also just copy the db file manually from your computer to the phone/simulator using the 'adb' utility in the Android tools directory.

      — commented October 7th 2010 by Alan Bourke
  • 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.

    — answered October 6th 2010 by Blain Hamon
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.