catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

When are SQL scripts rolled back?

I am a little confused about the description in the User Guide for the SQL Scripts page.

It states under Script Execution:
Run SQL Script
Select when the SQL script should be executed. You have three options:

At install
At uninstall
During rollback
This is then followed by the seemingly contradictory warning:
The changes made by an SQL Script on a database cannot be undone.
Uninstall won't rollback the changes performed by the SQL statements.
You will need to supply, if necessary, SQL scripts scheduled to run at uninstall or
rollback that will undo changes made by the scripts ran during install.
So, what is the purpose of the "During rollback" option in "Run SQL Script"?

Thanks,

cats
stretchedout2
Posts: 16
Joined: Wed Mar 25, 2009 1:37 pm

Re: When are SQL scripts rolled back?

I'm guessing that what they're saying is that they are not keeping track of the changes made in your scripts and that it is up to you to provide a sufficient "uninstall" or "rollback" script to match your "install" script.

stretchedout
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: When are SQL scripts rolled back?

stretchedout2 wrote:I'm guessing that what they're saying is that they are not keeping track of the changes made in your scripts and that it is up to you to provide a sufficient "uninstall" or "rollback" script to match your "install" script.
Yes, this is correct. The installation package cannot determine the changes performed by your SQL scripts during an install. Therefore, you should have a rollback and uninstall sql script for the installation rollback or uninstall of the package.

For example, your package can use three scripts:
- the first is set to run during install and creates a database (for example)
- the second is set to run during rollback, in case the database is created and the installation fails
- the third is set to run during uninstall and removes the database

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”