strict

--strict is a global Boolean attribute that specifies whether Liquibase enforces certain best practices and proactively looks for common errors. The default value is false.

--strict is similar to the parameter --pro-strict, which checks for the existence of Liquibase Pro resource files.

Uses

If you set --strict to true, Liquibase requires the following:

  • In all changesets, the author field must be non-empty
  • Properties in the defaults file (liquibase.properties) must be valid
  • LIQUIBASE_* environment variable names must be valid

It is a best practice to set --strict to true so that your changeset metadata is more useful and you can more easily tell if your properties and environment variables have problems. This lets you catch mistakes before you deploy your changes.

If you leave strict at its default setting of false, Liquibase ignores these requirements.

Liquibase 4.28.0 features

In Liquibase 4.28.0 and later, if you set --strict to true, Liquibase also checks for the existence of the following resource files:

  • Defaults file (liquibase.properties)
  • Files referenced in your changelog by sqlFile
  • Files included in your changelog via include and includeAll
  • Note: If you specify --strict as well as errorIfMissing (for include) or errorIfMissingOrEmpty (for includeAll), the values of errorIfMissing and errorIfMissingOrEmpty take precedence.

Liquibase 4.29.2 features

In Liquibase 4.29.2 and later, the / (forward slash) character is treated as a regular character when --strict=true and as a delimiter when --strict=false or not specified. For more information, see endDelimiter SQL attribute.

Liquibase 4.30.0 features

In Liquibase 4.30.0 and later, if --strict=true, Liquibase requires you to specify a tag that exists in your changelog when you run the update-to-tag command. If you specify a tag that does not exist, Liquibase halts.

Syntax

You can set this parameter in the following ways:

Option Syntax
Liquibase properties file (defaults file)
liquibase.strict: <true|false>
Global flow file argument (example)
stages:
  Default:
    actions:
      - type: liquibase
        command: update
        globalArgs: { strict: "<true|false>" }
Global CLI parameter
liquibase
 --strict=<true|false> update
 --changelog-file=example-changelog.xml

JVM system property (JAVA_OPTS Environment Variable)

JAVA_OPTS=-Dliquibase.strict=<true|false>
Liquibase Environment Variables
LIQUIBASE_STRICT=<true|false>

For more information, see Working with Command Parameters.

Output

Empty changeset author:

Unexpected error running Liquibase: Validation Failed:
    1 changes have validation failures
        ChangeSet Author is empty, example-changelog.xml::1::

Invalid property in the liquibase.properties file:

Error parsing command line: Strict check failed due to undefined key(s) for 'status' command in file exists at path liquibase.properties':
- 'invalid_property_name'
To define keys that could apply to any command, prefix it with 'liquibase.command.'
To disable strict checking, remove 'strict' from the file.

Invalid environment variable:

WARNING:

Liquibase detected the following invalid LIQUIBASE_* environment variables:

- LIQUIBASE_MADE_UP_VARIABLE

Please rename them and run your command again, or set liquibase.strict=FALSE or LIQUIBASE_STRICT=FALSE.
Find the list of valid environment variables at https://docs.liquibase.com/environment-variables

Error parsing command line: Liquibase detected the following invalid LIQUIBASE_* environment variables:

- LIQUIBASE_MADE_UP_VARIABLE

Please rename them and run your command again, or set liquibase.strict=FALSE or LIQUIBASE_STRICT=FALSE.
Find the list of valid environment variables at https://docs.liquibase.com/environment-variables

Related links