Rollbacks for State-based deployments
Published 02 April 2025
There are a few options to generate a rollback script when doing State-based deployments.
- Use flyway prepare and reverse the source and target to generate a script and save this as your rollback script.
- Use flyway snapshot to take a snapshot of your target database before deploying to it. You can then use SQL Compare Pro (GUI or CLI) with the snapshot as your source to see the changes and generate a script to roll the changes back.
Note: Be careful when using these comparison based methods for rolling back changes especially if transactional data is involved. It might be better to fix forward and have a fix flow through your existing deployment process.