If you have provided a custom rollback script for a non-DDL SQL script, then you normally do the following:
- Replace the original script: write a -replace script.
- Edit its existing custom rollback script.
A non-DDL script is one that is not packaged in the ddl directory.
Info |
---|
Do not use a Rollback scripts are always repackaged. When you change them, the version is incremented. |
See also /wiki/spaces/DDOC59/pages/795673649Rolling Back Changes.
Example Scripts
The following scenarios start with an existing SQL script and a custom rollback script for it.
myscript.sql
myscript-rollback.sql
Explicit Replacement of Both Files
You want to replace the existing script and modify its rollback behavior. Write a -replace script for the original script and update its custom rollback script. Package them in the same packaging run.
myscript-replace.sql
myscript-rollback.sql
Implicit Usage of Existing Rollback Script
You want to replace the existing file but do not want to update its custom rollback script.
myscript-replace.sql
In this case, myscript-rollback.sql
is replaced and the rollback script is repackaged for use with the replacement script. Its version is incremented.
Replacing Only a Rollback Script
You want to replace a rollback script. You can do this at any time, regardless of whether you are replacing the original script.
myscript-rollback.sql
In this case, edit myscript-rollback.sql
in place. During the packaging run it is repackaged and its version is incremented.
Cases Where Rollback Scripts Are Not Allowed
- Liquibase changelogs. See Packaging Liquibase Changelogs.