Questions about versioning and upgrade

Oct 21, 2010 at 9:49 PM

I had a couple questions about versioning and upgrading:

  1. If I change the schema of my objects in the future, and push an updated version of my application, I am assuming that loading of existing objects will fail on Deserialization. Do you have a recommendation to deal with this?
  2. If I grab a newer version of this library, and push an updated version of my application with the new version of the library, is there any mechanism for me to detect the version of the library that the original database was created in? I don't anticipate any compatibility issues, but if there were problems, and I had to have some startup code that needed to migrate to a new database, how could I get at the version of the database? Similarly, is there a way to stamp a database with my own version numbers?





Oct 22, 2010 at 1:31 AM

Hey, Adam

1.  No, you should be able to use existing data.  I cannot think of a scenario where this would not be the case.  Of cource if you add a property to your object, those properties will be null

2.  No, you would have to add this.  The easiest way I could think of is add a table that stores your version.  You can always get data from that table first, then determine how you upgrade existing data.

Of course, you should test this once you get a real device to be sure your code works as expected.

Nov 21, 2010 at 11:02 AM


I think it would be nice if the CreateDatabase(...) function took a version number (an int) that would be stored along the database name. Also, the function DoesDatabaseExists(...) would also take a version number and return false if the database does not exist or it exists and the version number stored is less than the number passed in the function. So developers would store a static constant version number in their application and increment it whenever they make a change in their database schema. As you said, the problem could be solved by creating a table for the version but it is a very common issue that would be nice if it was solved natively.