enumerationListContext
Last updated: January 30, 2026
enumerationListContext is a custom policy check that tells Liquibase that if a context is provided, the context value must match a specified pattern. This is different from UserDefinedContextCheck because context is not required in this check.
Before you begin
Scope | Database |
database | Relational |
Before you begin
Liquibase 4.29.0+
Configure a valid Liquibase Pro license key
Create a Check Settings file
Ensure the Liquibase Checks extension is installed. In Liquibase 4.31.0+, it is already installed in the
/liquibase/internal/libdirectory, so no action is needed.If the checks JAR is not installed, download
liquibase-checks-<version>.jarand put it in theliquibase/libdirectory.Maven users only:
Add this dependency to your
pom.xmlfile:
<dependency> <groupId>org.liquibase.ext</groupId> <artifactId>liquibase-checks</artifactId> <version>2.0.0</version> </dependency>
Java Development Kit 17+ (available for Open JDK and Oracle JDK)
Linux, macOS, or Windows operating system
Procedure
These steps describe how to create the Custom Policy Check. It does not exist by default in Liquibase Pro.
Provide Liquibase with a label value by entering this into the CLI:
liquibase checks copy --check-name=UserDefinedLabelCheck
Give your check a short name for easy identification
Use up to 64 alpha-numeric characters only.
In this example we will use:
ContextEnvironmentsDevUatProdSet the Severity to return a code of 0-4 when triggered.
These severity codes allow you to determine if the job moves forward or stops when this check triggers.
Learn more here: Use Policy Checks in Automation: Severity and Exit Code
options: 'INFO'=0, 'MINOR'=1, 'MAJOR'=2, 'CRITICAL'=3, 'BLOCKER'=4
Set the OPERATOR to the REGEXP option.
These are the options for this step: STARTS_WITH, ENDS_WITH, CONTAINS, REGEXP, EQUALS) [STARTS_WITH].
In this example, since we are creating a regex check, we will set the operator to REGEXP.
Set the SEARCH_STRING (options: a string, or a valid regular expression)
Regular expression
(?i:crq\d+)Sample Passing Changeset
--changeset ASmith:table01 context:PROD
create table table01 (
id numeric not null,
name varchar (255)
);
Sample Failing Changeset
--changeset ASmith:table01 context:INVALID_ENVIRONMENT
create table table01 (
id numeric not null,
name varchar (255)
);
Sample Error Message
DATABASE CHECKS
----------------
Checks completed validation of the changelog and found the following issues:
Check Name: Chained checks template (EnumerationListContext)
Changeset ID: table01
Changeset Filepath: changelogs/changelog.sql
Check Severity: MAJOR (Return code: 2)
Message: If context is provided, value must be DEV, UAT, or PROD.