Versions Compared

Key

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

Use a replace script to replace a deployed changes with the desired changes. 

...

The replace capability allows you to deploy a changeset that is specially marked for replacing prior changes.  During processing, the original changeset gets the attribute ignore=true to prevent it from being deployed further. 

See /wiki/spaces/DDD/pages/80707669Cleaning Up Deployed Changesets: cleanup

Pairing a Replace Script with a Cleanup Script

...

Replace scripts work for different types of "non-rerunnable" changes:

...

  • DDL folder or packageMethod=CONVERT
  • DDL_DIRECT folder or packageMethod=DDL_DIRECT
  • DATA_DML folder or packageMethod=DATA_DML
  • SQL_DIRECT folder or packageMethod=DIRECT
  • SQL folder or packageMethod=SQLFILE
  • Liquibase changelogs - replace the changesets packaged from the original changelog with changesets from the replacement changelog.

Cleanup and/or Replace are NOT recommended for stored logic (code: package, packagebody, procedure, function, trigger, view folders)

...

.  Use the provided versioning capability with stored logic instead. 

Replacing Changesets

For a file named myscript.sql, create a replace file that contains the code to replace what was deployed before. Use one of the following forms:

...

The file may use any extension (e.g. .sql) or no extension.

Liquibase will archive the -replace scripts as it did with the original script. 

Multiple Replace Changesets

If you need to replace the contents of a replace script, use another replace script with the same -replace name. You do not need to string together multiple replace statements. Liquibase will handle updating the contents of the -replace.

myscript-replace.sql

myscript-replace-replace.sql

Processing

Deployment Packager processes the -replace files during packaging, as follows:

...