Create rollback scripts
Last modified: July 4, 2024
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.
2. On the Source and Target page of the Change Schema Comparison Properties wizard, swap Source and Target to change the direction of synchronization.
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.
6. In the Schema Synchronization Wizard, choose the same options as you used to generate the deployment script.
7. Click Synchronize.
If you have chosen Open the synchronization script in the internal editor, the generated script will open in a SQL editor:
For more information on how to start a comparison project, refer to Select data sources for comparison.
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by Schema Compare for SQL Server.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.