Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 or _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 -replace/_replace script for a rollback script (myscript-rollback-replace). Packaging fails with an error if a script using -rollback-replace is found.  

Rollback scripts are always repackaged. When you change them, the version is incremented. 

See also Rolling 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 or 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 or myscript_replace.sql
  • myscript-rollback.sql or 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 or myscript_replace.sql

In this case, myscript-rollback.sql or 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 or myscript_rollback.sql

In this case, edit myscript-rollback.sql or myscript_rollback.sql in place. During the packaging run it is repackaged and its version is incremented. 

Cases Where Rollback Scripts Are Not Allowed