> This is not strictly a SQLite question, though in my case it is. > > Any application that involves a "persistent" database, i.e., one where the > data is long-lived and expected to exist and evolve over time, sooner or later > has the issue of moving customers from a V1 database to a V2 database.
Several have given examples of holding a schema version number in the database and having your application know how to upgrade from one to the next. I have used similar mechanisms, but one thing I would say. If you have to maintain older versions of your app, make a jump in the schema version when you switch major version of you app. For example, if you have version 1.5 of your app and you move to version 2.0, then you need to make a version 1.6 for some reason and it needs a schema change. If you jumped to say, schema version 100 for app 2.0, it is much easier to add a new schema version for 1.6 that can then be handled by 2.x Also, one system I worked on used SQL script files to make the database changes. e.g. There would be a script that updated from schema 2 to 3. To go with this there would also be a script that downgraded from schema 3 to 2. These scripts where left by the installer, so if you needed to install an earlier version of code, it could find the "downgrade" scripts and run them without the earlier version of code having to know how to downgrade. HTH Andy Ling ********************************************************************** DISCLAIMER: Privileged and/or Confidential information may be contained in this message. If you are not the addressee of this message, you may not copy, use or deliver this message to anyone. In such event, you should destroy the message and kindly notify the sender by reply e-mail. It is understood that opinions or conclusions that do not relate to the official business of the company are neither given nor endorsed by the company. Thank You. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users