Tonic has the ability to execute custom SQL scripts on the output database as soon as the database generation job has been completed.
Post-job scripts are can be accessed and edited on the Post-job Actions page. To create a post-job script, click the "Create Post-Job Script" button outlined below.
You can give your script a name, and write or paste in your SQL script, which will run on the destination database following the completion of the database generation job. Clicking the "Beautify" button will format your script to make it easier to read. NOTE: When working with MySQL, you must explicitly pass a USE statement to define the database.
By default, if an error is thrown while executing a post-job script, the entire job will be failed. Switching on "Enable Warnings" will simply register a warning upon the failure of a post-job script, allowing the job to fully complete.
The scripts section shows all of the scripts that have been created in a workspace. The scripts are displayed in the order in which they will be executed, with the script on top ("Modify Customer Ids," in the case below) being executed first, and the others following in order from top to bottom. You can drag the scripts around to reorder them if you would like to modify the order in which they are run.
Scripts can also be toggled on and off to enable and disable them using the switch to the left of the script name. When they are disabled, they will not be run following a job (In the case below, "Set IsDeleted To False For 2019 Orders" is disabled and will not run).
If you want to delete a post-job script configuration, click the trash can icon on the right; you will need to confirm deletion of that specific script prior to permanently deleting it. To edit a particular post-job script, click on the pencil icon; this will open the same dialog used to create the script.