Home > Blockchain >  What is the correct way to update a desktop software after editing its database?
What is the correct way to update a desktop software after editing its database?

Time:04-19

I have a desktop app that is in use by my clients. From time to time I fix some bugs, add features, and push new updates. An update works like this (automatically):

  1. Download new files for the app (Winrar).
  2. Extract the files to a temp folder.
  3. Copy the files to the app folder (overwrite the existing ones).

That's it. I don't touch the Database, which is an MS Access file in its own folder. I just update the files, not the database, because I don't want the clients to lose their data.

Now I've made some schema changes to the database (added some columns, tables...), so I have to update the database file this time as well.

How can I update these database files so the clients won't lose their data?

CodePudding user response:

One option is defining the changes as a series of SQL commands such as ALTER TABLE to run against the database. Put these commands in a special file (or files) and build logic into your updater (or during the launch of your app) to detect and run them.

This has the additional benefit of allowing you to keep these changes with the version control system managing the source code for your app.

  • Related