BinaryMee
BinaryMee

Reputation: 2142

updating Installer by keeping the DB of the previous version Installation intact - Visual Studio Installer

I have created an Installer of my project using Visual studio Installer. My product will be updated frequently. So I need to give updates in some period of time. I can able to create version by changing Product code and keeping the old upgrade Code intact.

But the problem is,

I am having a SQLite database which is installed in my Application Folder(Installation folder).

On my next updated version there might be some change in the schema of the DB. But the data stored by the previous version also required by the recent version even if the database is updated and schema has been changed slightly.

My thought is to have a backup of previous version while installing the next version. And once the recent version has been installed the modified DB should take the data from the previous DB in the backup folder and should be updated. If some exception arises while installing the newer version, the installation process should be rolled back and previous version should be kept intact. Custom Actions in the VSI might help in this case.

Is there any way to achieve it.? If there are any other ways to achieve the problem I would like to know it.

Upvotes: 0

Views: 329

Answers (1)

Kurubaran
Kurubaran

Reputation: 8902

So I need to give updates in some period of time.

Best solution to update existing application is to use OnceClick which is a Microsoft technology using which you can push update to client machaines in more elegant way.

once the recent version has been installed the modified DB should take the data from the previous DB in the backup folder and should be updated.

I agree you will have to always take database backup if anything goes wrong during the update and if you want to recover everything. But how are you going to get the data from backup database and update the new database ? Are you going to read data in each table and insert into new database tables ?

I would suggest you not to copy new database schema when application update happens, Rather just include delta script with the update package. this delta could be just a column size or datatype change etc.

What you have to do is,

  1. Take the database backup
  2. Execute the delta script on the existing database, Which will upgrade the database to new version.

In this approch you will get rid of lots of complexities which you will have to handle if you follow the approach you have mentioned(Copying new database and get data from old DB)

Upvotes: 1

Related Questions