Update DB structure (SQlite)

stefanoa

Active Member
Licensed User
Longtime User
hi,
what is the best way to update the db of an application already on the market?

i have to check the version installed in phone and update the DB with new version without deleting the existing database but updating it adding or removing field, renaming field, etc.. (alter table...) or adding table, etc.

actually i use GetDBVersion to control db version (and SetDBversion to set new version).

thanks
 

DouglasNYoung

Active Member
Licensed User
Longtime User
stefanoa,
SQLite only supports a limited subset of the 'Alter table' command where you an rename a table or add fields.

One solution is to create a temporary table with the format; read the old data into the new table; rename the old table; and finally rename the temporary table to permanent table name. This has the advantage of the original data remaining intact if something goes wrong!

Good luck,
Douglas
 
Upvote 0
Top