Create rollback scripts

If 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 SQL database.

Note

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

To create a rollback script in Schema Compare, you need to compare the same settings as when you сompare databases to get a deployment one. The only difference is that you switch the source and target databases on the Source and Target page of the Change Schema Comparison Properties wizard. Then, you need to repeat 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 Comparison menu, select 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 direction of synchronization.

Swap Source and Target

Note

Keep in mind that this method will reset any manual mapping that was previously set. Thus, you will have to set custom schema and object mapping manually.

3. Once done, 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 Schema Synchronization Wizard, choose the same options as you used to generate the deployment script.

7. Click Synchronize.

Schema Synchronization Wizard

If you have chosen 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.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Schema Compare for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Schema Compare in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Schema Compare for your business, request a demo to see it in action.
Ready to start using dbForge Schema Compare for SQL Server?