run
Note: This is a Liquibase Pro feature, so you need a Liquibase Pro License Key to use it.
The run
subcommand executes checks using the checks settings file against a changelog, database, or both. Quality checks support XML, SQL, YAML, and JSON changelog formats, and all the Liquibase Pro-certified databases.
Uses
The checks run
executes enabled checks based on the --checks-scope
property. To specify the scope, set checks-scope
to changelog
, database
, or changelog,database
to run both scopes.
The checks run
command by default executes the enabled changelog checks against the specified changelog using the checks settings files, which can have default and/or non-default locations. When you run a database-scoped check, Liquibase takes a snapshot of your database to run the checks against.
If your files are not stored in the Liquibase working directory, specify the relative path to them. Check How Liquibase Finds Files: Liquibase Search Path for more details.
In Liquibase Pro 4.26.0 and later, you can use checks run
to seamlessly generate a Checks Run Report for your database.
Note: To view a list of available checks, run liquibase checks show
.
Syntax
Run the command specifying your values:
liquibase checks run --changelog-file=basicRule.postgres.sql
Note: If you have a checks settings file customized for a specific environment or project, you need to pass that using the --checks-settings-file
parameter. If you do not include this parameter, Liquibase uses the default settings file: liquibase.checks-settings.conf
. See Use the Checks Settings Configuration File.
To execute checks that require a database connection, you must also include connection attributes such as the database url
.
Command arguments
The following table identifies parameters that are accepted or required by the run
subcommand. If the Default column states "Required," it is required to run the command successfully. If it states "Null," it is an optional command argument. Each command argument helps you narrow down the liquibase checks run
command to ensure that only very specific content is affected by the command.
Tip: For best results, specify all commands and parameters in the --kebab-case
format in the CLI. If your preference is camelCase, it also works in the CLI.
Name | Default | Syntax | Description |
---|---|---|---|
--auto-update (Enumeration) |
Null |
CLI: Property: Environment Variable: |
Allows automatic backup and updating of the Default: off |
--cache-changelog-file-contents (Boolean) |
true |
CLI: Property: Environment Variable: |
If true, sqlFile change type contents will be cached in memory to improve performance, at the cost of higher memory usage. To reduce memory usage, set this to false. |
--changelog-file (String) |
Null |
CLI: Property: Environment Variable: |
The changelog file against which you execute checks when running |
--changeset-filter (String) |
ALL |
CLI: Property: Environment Variable: |
Specifies whether quality checks run on |
--check-name (String) |
Null |
CLI: Property: Environment Variable: |
Use this to specify the short name of the check you want to target with one of the following subcommands:
|
--check-rollbacks (Boolean) |
false |
CLI: Property: Environment Variable: |
Allow changeset's rollback code to be analyzed for compliance with currently enabled quality checks. |
--checks-output (Enumeration) | all |
CLI: --checks-output=<quoted comma-separated list of options> Property: liquibase.command.checks.run.checksOutput: <comma-separated list of options> Environment Variable: LIQUIBASE_COMMAND_CHECKS_RUN_CHECKS_OUTPUT=<quoted comma-separated list of options>
Examples: liquibase checks run --checks-output="issues4, checksrun" export LIQUIBASE_CHECKS_CHECKS_OUTPUT="issues,skippedchecks"; liquibase checks run |
Specify which parts of the checks run output should be shown. Options:
Default: all |
--checks-scope (String) | Null |
CLI: Property: Environment Variable: |
The Liquibase component to run checks against, which can be a comma separated list Dual-scoped: Can run against changelogs and databases separately or simultaneously. |
--checks-settings-file (String) |
Null |
CLI: Property: Environment Variable: |
Specifies the checks settings file to use with subcommands. Write the relative path of the settings file that you want to read from or modify. For more information, see Use the Checks Settings Configuration File. |
--format (Enumeration) |
text |
CLI: Property: Environment Variable: |
Only Available in Liquibase Pro Sets the format of the check output to text or JSON. Default: text For more information, see Quality Checks JSON Object. |
--labels (String) |
Null |
CLI: Property: Environment Variable: |
Changeset labels to match |
--package-file (String) |
Null | CLI: liquibase checks run --packages-file=securuity-checks.pkg Property: |
The file name of the yaml file to be created. defaults to liquibase.checks-package.yaml if not set.. For more information see Quality Checks Packages |
--package-name (String) |
Null | CLI: liquibase checks run --packages-name=security-checks.pkg Property: |
The name of the checks-package object inside the file to be created. For more information see Quality Checks Packages |
--package-contents (String) |
Null | CLI: liquibase checks run --packages-contents=security-checks.pkg Property: |
The file, files, or dir of files to be included in the |
Alias:
|
true | CLI: liquibase checks run --property-substitution-enabled=true|false Property: |
Allows you to check to see if changeset text is evaluated pre or post property substitution. This argument is for the whole of checks run , not a specific quality check. |
--schemas (String) |
Null |
CLI: Property: Environment Variable: |
The schemas to check when checks-scope contains database |
--sql-parser-fail-severity (Enumeration) | severity of the check |
CLI: --sql-parser-fail-severity=[0|1|2|3|4] Property: liquibase.command.checks.run.sqlParserFailSeverity: [0|1|2|3|4] Environment Variable: LIQUIBASE_COMMAND_CHECKS_RUN_SQL_PARSER_FAIL_SEVERITY=[0|1|2|3|4] |
Allows specification of the severity value returned when a check fails due to a SQL parse error. Return Codes: Default: severity of the check |
--verbose (Boolean) |
false |
CLI: Property: Environment Variable: |
Verbose flag with optional values of 'True' or 'False'. The default is 'False'. |
Note: The --snapshot-format
attribute is not supported by checks run
.
run
example output
Starting Liquibase at 13:53:58 (version 4.9.1 #1978 built at 2022-03-28 19:39+0000)
Liquibase Version: 4.9.1
Executing Quality Checks against example-changelog.sql
Executing all checks because a valid Liquibase Pro license was found!
Changesets Validated:
ID: 1; Author: Amber.Williams; File path: example-changelog.sql
ID: 2; Author: Amber.Williams; File path: example-changelog.sql
ID: 3; Author: other.dev; File path: example-changelog.sql
Checks run against each changeset:
Warn on Detection of 'GRANT' Statements
Warn on Detection of 'REVOKE' Statements
Warn when 'DROP TABLE' detected
Warn when 'DROP COLUMN' detected
Warn when 'MODIFY column' detected
Check Table Column Count (Short Name: 1234)
Check Table Column Count
Warn when 'TRUNCATE TABLE' detected
Warn on Detection of grant that contains 'WITH GRANT OPTION'
Warn on Detection of grant that contains 'WITH ADMIN OPTION'
Rollback Required for Changeset
Changesets Must Have a Label Assigned
Changesets Must Have a Context Assigned
Changesets Must Have a Comment Assigned
Liquibase command 'checks run' was executed successfully.