Create rollback scripts

Last modified: July 4, 2024

Should you encounter any issues or errors during the deployment, you can create a rollback script to reverse a deployment or undo changes made to a database.

Note

It is crucial to create an undo or rollback script before deploying the database changes.

Workflow

To generate a rollback script in Schema Compare, you must configure the comparison settings just like you would when comparing databases for deployment. The only difference is switching the source and target databases on the Source and Target page of the Change Schema Comparison Properties wizard. Then, you must re-run the comparison to generate a script.

Before deploying object changes, it is highly recommended to:

  • Make a backup of the database
  • Save the database structure in a script folder to quickly generate a rollback script using dbForge Schema Compare

To create a rollback script

1. On the ribbon, select Comparison > Edit Comparison. Alternatively, on the Schema Comparison toolbar, click Edit Comparison.

Edit Comparison

2. On the Source and Target page of the Change Schema Comparison Properties wizard, swap Source and Target to change the synchronization direction.

Swap Source and Target

3. To run the schema comparison, click Compare.

4. Review the generated .scomp document.

5. Click Synchronize objects to the target database to open the Schema Synchronization Wizard.

Synchronization

6. In the wizard, choose the options you used to generate the deployment script.

7. Click Synchronize to run synchronization.

Schema Synchronization Wizard

If you select Open the synchronization script in the internal editor, the generated script will open in a SQL editor:

Internal Editor

For more information on how to start a comparison project, refer to Select data sources for comparison.