EndDelimiterExistsWhenPatternExists
This check triggers when the following criteria are met:
- A changeset contains the supplied pattern string or regex.
- No end delimiter exists specifically in the changeset or via options such as the 'pro-global-end-delimiter' or 'endDelimiter' attribute set on a specific changeset and/or 'endDelimiter' set in a changelog called by
include
orincludeAll
inmodifyChangeSets
tag.
Uses
Certain changesets need an end delimiter specifically set, while others do not need the end delimiter. This check makes sure changesets that require an end delimiter have one before moving forward in a job.
Run the endDelimiterExistsWhenPatternExists
check
To run the endDelimiterExistsWhenPatternExists
check, ensure you have a Liquibase Pro license and the checks-scope
property includes changelog
. The checks-scope parameter is set in the default properties file, environment variable, or any standard method.
Tip: endDelimiterExistsWhenPatternExists
logic: If a custom pattern exists in a changeset, then that changeset must have an endDelimiter
. If the endDelimiter
does not exist, this check notifies the user.
In this example, you are checking to see if a user-provided custom pattern exists in a changeset and if it has an endDelimiter
. When this check is enabled successfully, Liquibase will notify the user with a message if it detects the user provided pattern and there is no endDelimiter
.
-
Enable the
endDelimiterExistsWhenPatternExists
check by running the following command in the CLI:liquibase checks enable --check-name=
endDelimiterExistsWhenPatternExists
- Give your check a short name for easy identification such as
endDelimiterPattern
. The newendDelimiterPattern
check is created from theendDelimiterExistsWhenPatternExists
.Note: You can use up to 64 alpha-numeric characters in any short name.
-
In the CLI, set the Severity to return a code of 0-4 when the check is triggered. Set the severity to 0.
Your options are:'INFO'|0, 'MINOR'|1, 'MAJOR'|2, 'CRITICAL'|3, 'BLOCKER'|4)
-
Set the
'SEARCH_STRING'
to a string or a valid regular expression.
Set it to a regular expression(ALTER|DROP)\s*TABLE
. -
Set the case sensitivity to true or false.
Set it to'CASE_SENSITIVE' false
. -
Set the 'STRIP_COMMENTS' to
true
orfalse
.
Set it totrue
. -
Set the 'MESSAGE'. The default message is:
The pattern '<SEARCH_STRING>' was found without an end delimiter in Changeset '<CHANGESET>
.Once successfully run, the customization is complete. Review the table below to confirm your changes.
EndDelimiterExistsWhenPatternExists | changelog | disabled | 0 | SEARCH_STRING = null | This check triggers when a | | | | | | CASE_SENSITIVE = true | changeset contains the | | | | | | STRIP_COMMENTS = true | supplied pattern string or | | | | | | MESSAGE = The pattern | regex, but does not have an | | | | | | '<SEARCH_STRING>' was found | end delimiter set specifically | | | | | | without an end delimiter in | in the changeset or via | | | | | | Changeset '<CHANGESET>'. | options such as | | | | | | | 'pro-global-end-delimiter' or | | | | | | | 'endDelimiter' attribute in a | | | | | | | modifyChangesets tag. |