i have a sqlite file in my app. the app is with enterprise certificate .
Now , if i am going to create new version with the changes in database then :
1) i have to change my Sqlite file name ?
2) if yes , then is there any way that if any person who is using my app, who has his saved data in app , will be inserted automatically in new version of my app .
otherwise if i create new file and then the older data would be removed!!!
Thanks in advance..
1) AFAIK, when you update, the old app bundle is replaced with the new app bundle. But the user data is untouched. i.e. the copy of the sqlite DB which the app changes with use by the user, is not deleted/replaced.
2) So, you can possibly ship changes to the DB as queries:
a) New tables go in as
CREATE TABLEqueries.b) Changes to table structure go in as
ALTER TABLEqueries.3) Now, one problem is, you didn’t think about all this when you shipped the older version. So how will you make sure the queries 2a and 2b are executed only on upgrade?
a) When you first get control in the application, before allowing user interaction, fire a dummy
SELECT SINGLE * FROM <tablename>on a table you have ‘changed’ in new version.b) Use
sqlite3_column_countandsqlite3_column_nameto find out which version of the app the DB corresponds to [old or new].c) If it is new version (i.e. new columns already exist), do nothing, else fire the queries I mentioned earlier as 2a and 2b.