Skip to content Skip to sidebar Skip to footer

Sqlite Onupgrade() Frustration

I'm working with a prepopulated database. Using SQLite Manager in Mozilla, right now I have a dummy database and just wanted to test out the onUpgrade method, so I altered a string

Solution 1:

Upgrading a database means changing it in place while keeping the old data intact as much as possible. So if you want to add or rename a column, you have to execute the proper SQL command to do this in the onUpgrade callback.

(Note: SQLiteAssetHelper makes using a prepopulated database easier, and you should use it, but upgrading still needs a separate SQL script.)

If you do not care about the contents of the old database, then you should not upgrade it. Just give your new database version a new file name, so that it is simply copied over, and delete the old file.

Post a Comment for "Sqlite Onupgrade() Frustration"