I've created predefined connection and query that create DB indexes (I used quey and not sql script becouse I need to play with the sequence of the script execution stage).
the installer completed succesfully but the script didn't execute.
the installer completed succesfully but the script didn't execute.
The query probably executed, but it did not work. Please keep in mind that a query can be used only to interrogate the database. You can not create indexes using a query, a script will be needed for such a task.
I tried to use SQL script but realized that I cant impact the execution order and prior to executing the SQL script I need to run EXE that creates the DB.
I tried to use SQL script but realized that I cant impact the execution order
Indeed, you are right. SQL Scripts can only be executed during the deferred stage. However, unfortunately, I am afraid that an SQL Query can only be used to interrogate a database, not to create it.
Thanks for the response.
So if I need to run exe first that creates the database and than I need to run SQL script for creating indexes how do you suggest to implement that ?
If you have an .EXE that creates the database, then you can launch that .EXE during the installation. The custom action that launches this .EXE should be scheduled after the "InstallFiles" standard action (the action that installs the files from the "Files and Folders" page. The reason behind this is the fact that the .EXE should exist on the target machine so we can launch it.) and before the "PatchFiles" standard action. The execution of the SQL scripts takes place after that, so everything should work just fine.
In order to achieve this, you can go to "Custom Actions" page --> under "Install Execution Stage" right click on any action group --> "Show standard actions" --> "Add resources" --> select both "InstallFiles" and "PatchFiles".
After doing so, simply schedule your custom action between the above specified standard actions and change its execution time from "Immediately" to "When the system is being modified (deferred).