ozgekaya
Posts: 20
Joined: Thu May 08, 2014 7:52 am

SQL Script During Rollback

Hello,

I'm trying to drop databases I created during uninstall and rollback. The script is looking like this:

Code: Select all

USE [master]
GO

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'SchameName')
DROP DATABASE [SchemaName]
GO
It works on uninstallation but is not working on rollback. It seems the script is not running on rollback at all. I tried to create another script and chose "during rollback" checkbox only.It failed too.

I tried a new custom action which is running on installation-during installation rollback as

Code: Select all

sqlcmd -S [DB_SERVER_NAME] -i [#dropDB.sql] 
but this also fails.

I am not sure if my other custom rollback actions are running too. How can I make it work?

Özge
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: SQL Script During Rollback

Hi Özge,

I've tested your scenario and it worked as expected.
The script marked to be executed during rollback in the SQL Script Tab, were properly executed.

Can you please try to retest your scenario? If the behaviour still persist, please send me your .AIP(project file) to support at advancedinstaller dot com so we can investigate it. If it contains confidential information you can send us a small test project which reproduce this behavior.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ozgekaya
Posts: 20
Joined: Thu May 08, 2014 7:52 am

Re: SQL Script During Rollback

Hi Dan,

I will create a simplified example. In the mean time, I found out that the rollback script runs when there is an error in the installer. What I want is to rollback the actions when I cancel manually. Maybe that's the problem. Shouldn't rollback work when user cancels manually?

Edit: I sent a sample project replicating the same issue by email.

Regards,
Özge
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Script During Rollback

Hello Özge,

Please keep in mind this is the normal behavior if the user cancels installation before the SQL scripts execution during "Install Execution Stage -> Add Resources -> AI_SqlInstall" custom action, on deferred stage of the installation process. If the user cancel the installation anytime before this stage, then the SQL script configured to run on rollback won't be executed. The SQL scripts configured to run on rollback will be executed only if the installation interrupts after the execution of SQL scripts scheduled on install (after the "AI_SqlInstall" custom action is executed).

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ozgekaya
Posts: 20
Joined: Thu May 08, 2014 7:52 am

Re: SQL Script During Rollback

Hello Daniel,

During installation I can see some of the databases are created with my script and then I push cancel button. The databases schemas created before I cancel the installation still exist on the system. If the rollback scripts are not running at this stage how can I remove these databases? Should I use a custom action that will ,somehow, run when users clicks on cancel button?

ALternatively, is there a way to disable cancel button till the installer reaches the point where I can rollback all actions.

Regards,
Özge
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Script During Rollback

Hello Özge,

I've tested the scenario and indeed, the SQL scripts scheduled on rollback don't run when the user cancels the installation during or after the SQL scripts (scheduled on install) execution. This seems to be an Advanced Installer issue caused by our Enhanced User Interface feature. A fix will be available in a future version of Advanced Installer, thank you for helping us to isolate this issue. We'll update this thread when the fix will be out.

Until then, as a workaround, you can disable the "Enhanced User Interface" feature. Please note that when the EUI is disabled the only theme you can use for installation dialogs is the "Classic" one. Also, after changing the theme from "Themes" page, all of your customization made on installation dialogs ("Dialogs" page) will be lost. As another solution, you can try to use a custom action which will drop your created databases. The custom action should be scheduled (on rollback) just before "Install Execution Stage -Add Resources -> RegisterTypeLibraries" standard action.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Script During Rollback

Hello,

This was fixed in version 16.2 of Advanced Installer released on August 1st, 2019.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”