database structure to update efficiently
hi folks,
imaging the follow scenario:
i have a sqlite-database for an iphone app with some "documents" as templates. the user is able to add his own templates too. now i want to update the program and the database. is there any chance to do so without overwriting the users data?
i thought about two different db but since this is an overhead it want to avoid this.
2 Answers
-
Accepted Answer
I was thinking this same thought. Does Titanium let you delete files from your apps directory? If so, I would think the code would flow like this. if (old_database_exists) insert into new_database (select * from old_database) delete old database
-
When you're updating a production database, just like any other database app, you'll need to write SQL scripts to migrate your database to the newer version. Titanium doesn't provide any mechanism for doing this, but the practice of migrating production databases via SQL scripts is pretty common. You might consider adding database version information to your database and check that in your script, similar to how Ruby on Rails migrations work.