Configure Quality Checks
Liquibase provides a default set of checks with default settings defined in the checks settings file.
Quality checks are either static or dynamic. A dynamic check can have multiple configurations, whereas a static check can have one.
- A check is static if the attributes of the check cannot be customized. You can enable or disable static checks. You cannot copy, customize, or delete static checks.
- A check is dynamic if there are settings you can customize. Dynamic checks contain values possible to modify according to your needs.
- You can copy, customize, and reset dynamic checks but cannot delete them.
- You can copy, customize, delete, and reset the copy of a dynamic check to the parent check’s default settings.
- All checks can be enabled or disabled. Liquibase Pro users can run unlimited enabled checks, and Liquibase Community users can run the first 5 enabled checks.
For now, Liquibase provides the following checks:
- Checks for changeset elements
- Checks for DROP and TRUNCATE statements
- Checks for GRANT and REVOKE privileges
- Checks for data
Checks for changeset elements
Ensure changesets have a label or context assigned
Attribute | Value |
---|---|
Short name |
|
Description |
The checks enforce the Liquibase recommendation that labels or contexts be assigned to each changeset to provide better deployment control and to enhance traceability of efforts across changesets. For example, you have a changelog file with at least one changeset that does not have labels or contexts defined. When you execute Additionally, see the following check variation:
Note: Labels are not inherited from the parent changelog, so none of the changesets in an included changelog will automatically get a label. Therefore, the quality checks will warn that the child changesets do not contain a label unless the label has been explicitly added to the child changelog’s changeset. |
Type | Static |
Enabled by default | Yes |
Ensure changesets include a comment
Attribute | Value |
---|---|
Short name | ChangesetCommentCheck
|
Description |
The check enforces the Liquibase recommendation that comments be added to each changeset to document the purpose of a changeset for other consumers of that changelog. For example, you have a changelog file with at least one changeset that does not have a comment added to it. When you execute |
Type | Static |
Enabled by default | Yes |
Ensure changesets include a rollback
Attribute | Value |
---|---|
Short name | RollbackRequired
|
Description |
The check detects when a changeset does not have a rollback defined so that you can deploy and revert schema changes when needed. For example, you have a changelog file with at least one changeset that does not have a rollback added to it. When you execute Tip: Liquibase recommends writing explicit rollback code for a changeset, where possible. While Liquibase does generate automatic rollback code for many Change Types, this check triggers when rollback code is not included. |
Type | Static |
Enabled by default | Yes |
Checks for DROP
and TRUNCATE
statements
Detect dropped tables
Attribute | Value |
---|---|
Short name | ChangeDropTableWarn
|
Description |
The check warns when a table is being dropped. This ensures that dropping the table will not lead to unintentional loss of data. For example, you have one of the following:
When you execute |
Type | Static |
Enabled by default | Yes |
Detect dropped columns
Attribute | Value |
---|---|
Short name | ChangeDropColumnWarn
|
Description |
The check warns when a column is being dropped. This ensures that dropping the column will not lead to unintentional loss of data. For example, you have one of the following:
When you execute Additionally, see the check variations:
|
Type | Static |
Enabled by default | Yes |
Detect TRUNCATE
statements
Attribute | Value |
---|---|
Short name | SqlTruncateWarn
|
Description |
The check warns when generated or raw SQL contains For example, you have a changelog file with one or more changesets that include the When you execute Additionally, the check will warn if the statement does not contain the |
Type | Static |
Enabled by default | Yes |
Checks for GRANT
and REVOKE
privileges
Detect GRANT
statements
Attribute | Value |
---|---|
Short name | SqlGrantWarn
|
Description |
The check warns when generated or raw SQL contains For example, you have a changelog file with at least one changeset that includes the |
Type | Static |
Enabled by default | Yes |
Detect REVOKE
statements
Attribute | Value |
---|---|
Short name | SqlRevokeWarn
|
Description |
The check warns when generated or raw SQL contains For example, you have a changelog file with at least one changeset that includes the |
Type | Static |
Enabled by default | Yes |
Detect when granting specific privileges
Attribute | Value |
---|---|
Short name | SqlGrantSpecificPrivsWarn
|
Description |
The check warns when a changeset contains SQL that grants specific privileges to a user or role. Uses You may have a changelog file with one or more changesets that contain the When you execute To enable
Follow the CLI prompt to customize the check, specifying one or more privileges separated by commas. If the privilege includes spaces, enclose it in double quotes:
Note: See the Configurable attributes for specific privileges table for the attributes you can customize. |
Type | Dynamic |
Enabled by default | Yes |
Configurable attributes for specific privileges
Name | Type | Description | Validation | Default value |
---|---|---|---|---|
PrivilegeList
|
List
|
The list of database or system privileges that should produce a warning when granted to a user or role |
|
There is no default value |
Detect GRANT WITH ADMIN OPTION
and GRANT WITH GRANT OPTION
statements
Attribute | Value |
---|---|
Short name |
|
Description |
The checks warn when generated or raw SQL contains the For example, you have a changelog file with one or more changesets that include the When you execute Note: The privilege name and role or username can be any privileges, roles, or users. The privilege name can be multiple tokens or words, and the role and username can be a comma-separated list of roles and users. |
Type | Static |
Enabled by default | Yes |
Checks for data
Detect data type modification
Attribute | Value |
---|---|
Short name | ModifyDataTypeWarn
|
Description |
The check warns when a change will result in modification of a data type so that you can ensure that modifying the data type will not lead to unintentional loss of data. For example, you have one of the following:
When you execute Additionally, see the check variations:
|
Type | Static |
Enabled by default | Yes |
Check object names for a specific pattern
Attribute | Value |
---|---|
Short name |
|
Description |
The checks confirm that object names do or do not conform to the specified pattern. For example, you have a changelog file with one or more changesets that include the When you execute |
Type | Static |
Enabled by default | Yes |
Check SQL for a specific pattern
Attribute | Value |
---|---|
Short name | SqlUserDefinedPatternCheck
|
Description |
The check scans generated or raw SQL for the presence of specific patterns so that you can prevent security and velocity issues as early as possible. UsesYou may have a JSON, YAML, or XML changelog file with one or more changesets that contain raw SQL or produce generated SQL that matches a regular expression. When you execute Note: Liquibase uses the java.util.regex engine to match regular expressions. You may also have a formatted SQL changelog file to check changesets that have labels, but those labels do not match the check configuration. To use the
Note: See the Configurable attributes for SQL that contains a specific pattern table for the attributes you can customize. |
Restrictions |
You cannot delete or reset the You cannot reset a customized copy of the |
Type | Dynamic |
Enabled by default | No |
Configurable attributes for SQL that contains a specific pattern
Name | Type | Description | Validation | Default value |
---|---|---|---|---|
SearchString
|
String
|
The substring or regular expression to match with the one in the changelog file | SearchString should be a valid string or a regular expression. |
There is no default value |
StripComments |
String
|
The attribute to strip comments from SQL before searching for the string. |
Yes/No |
The default value is N (no) |
Message
|
String
|
The message you want to print when the check detects a pattern match | There is no validation | The default value is the following:
A match for regular expression <SearchString value> was detected in changeset <changeset id> |
Check table column count
Attribute | Value |
---|---|
Short name | TableColumnLimit
|
Description |
The check ensures that no table has more than a threshold number of columns. UsesYou may have a changelog file with one or more changesets that contain a table with You can copy and customize the
Note: See the Configurable attributes for a table column count limit table for the attributes you can customize. |
Restrictions |
You cannot delete or reset the You cannot reset a customized copy of the |
Type | Dynamic |
Enabled by default | Yes |
Configurable attributes for a table column count limit
Name | Type | Description | Validation | Default value |
---|---|---|---|---|
MAX_COLUMNS
|
INT
|
The substring or regular expression to match | There is no validation | The default value is 50 |