views:

25

answers:

1

Hello,

I want that my users can read my sqlite database still in 10 years, because there could be data in it they want to browse.

Well the database file is 10 years old. In the meantime I have upgraded my database structure (additional fields is best example) and my latest version of the application makes use of that new fields.

Now the user wants to load the 10 year old database with the brandnew application version. But that won`t work, because in the old database file there are some fields missing.

How would you deal with such a scenario?

+2  A: 

The easiest way to handle this is to leave your new application alone. Have it only work with the new format. In the long run this will be easier, because your program won't have to account for working with a bunch of different data structures.

Create a program which "upgrades" (creates a new file and transfers the data etc. or however you want to handle it) the old database file to resemble the new one.

Kevin
the "upgrade" function also acts as an "import"
Beth
@Kevin So what you advise me is to make a Database_Converter tool and attach it to the application so it is distributed together. This tool will allow the user to load an old database and all its data and transfer it into a database with the new structure? What if one of the new fields does not allow null values? So I must insert some data which is not available in the old database. What would you suggest for this situation?
msfanboy
@msfanboy pretty much yeah. How you handle the conversion will have to be on a case by case basis. When you change the database for the new program, you'll probably have to keep in mind what was allowed in the previous version and how to upgrade. Personally, I wouldn't attach the upgrade program to the new version. I would allow them to contact you to get it. Two reasons, one if there is a problem with the upgrade program you can fix it before sending it out to anyone else who asks for it. Two when you create the version after next you can decide about how to go from v1 to v3 then.
Kevin
If you don't include it automatically, then there is no expectation of you including it in the future. You'll probably still want to be able to send it to people, but you don't have to solve how to upgrade existing systems on day 1.
Kevin
ok all in all it sounds ok ;-)
msfanboy