liquibase.precondition.Precondition implementations allow you to run validation and checks against your database before running a changelog as a whole, or before running individual changesets.
Custom parsers must implement liquibase.precondition.Precondition, which includes the following methods:
public String getName(); |
Return the name used in XML and other changelogs to refer to the precondition.
public void check(Database database, DatabaseChangeLog changeLog) throws PreconditionFailedException, PreconditionErrorException; |
Perform the check. Throw a PreconditionFailedException if your precondition did not pass. Throw a PreconditionErrorException if there was a problem evaluating your precondition.
There are two ways to register a custom Preconditions:
Precondition implementations should be created thread safe. Once an instance of a Precondition registered, PreconditionFactory will continue to use the same instance.