3

I've one windows application which uses sqlite DB. I've created a setup for this application using setup and deployment project. I may have to make builds every other month with changes in the application and user has to update it.

My application creates sqlite DB file when it runs for the first time. If DB file is there then it doesn't create it. Now, when I've an update for the application I'll have to make some changes in the DB schema as well. In this case user might have some data in the sqlite DB as well. I should not touch the data but update the DB schema. Also this will happen once in few months, as I'll be adding new features to the application.

How do we normally handle this kind of update for the application. I'm making new setup every time I add new features to the application, which will uninstall existing version and installs the new version. But I'm confused about the database part. How should we handle this incremental update in the DB schema?

Any suggestions?

JPReddy
  • 63,233
  • 16
  • 64
  • 93

3 Answers3

1

Autopatchnet - This project is a .Net port of AutoPatch based on the original TactiKnowledge dotnet project.

ecm7migrator - This project is fork from Migrator.NET.

Migrator.NET - Database migrations for .NET. Based on the idea of Rails ActiveRecord Migrations.

AlexandrYZ
  • 331
  • 2
  • 6
  • Yup; pretty much the answer is database versioning/migrations (which you should be doing for your code anyway, not just deployment). – strager Nov 18 '10 at 06:56
1

You should have a DB version number in your database and get your app to update the database depending on the version number. So your sql update scripts will be contained in/called by your application, and be processed on startup.

The setup will update the code and files, and your application will update the database.

Jla
  • 11,304
  • 14
  • 61
  • 84
  • Database has been in implemented in the way you said. Application update is done in a different way. I answered my own question. – JPReddy Nov 18 '10 at 13:16
0

Although above answers will address my issue up to certain extent, I have come up with different approach altogether.

I've used database update approach given by DrDro. For the application update I think I have a better approach. I found one article which talks about automatic update of the application from the application itself whenever there is new update available at the source (In my case server).

Here is the article (This link is updated as earlier link was not working). It explains about this approach very clearly and it was bulls eye for my requirement.

JPReddy
  • 63,233
  • 16
  • 64
  • 93
  • @stigzler This is very old answer and unfortunately they have removed it. Updated the answer with a link similar to the one I used. – JPReddy Apr 01 '19 at 06:57
  • Thanks fella. But in the mean time, I found a much better solution for single file db's in Windows Applications called LiteDB. It works around all of the usual headaches with ADO.net, Entity Framework etc. It's increadbily flexible once you get the hang of it with painless schema and data updates etc. – stigzler Apr 02 '19 at 19:28