should-run

The --should-run global parameter is a Boolean that determines whether Liquibase commands should run. By default, it is set to true.

Uses

If you use a Servlet Listener with Liquibase, you can set the --should-run parameter to control whether specific servers run Liquibase commands. This can be useful if you do not want to set the LIQUIBASE_HOST_EXCLUDES or LIQUIBASE_HOST_INCLUDES attributes in your servlet listener, but still need to include or exclude some host names from running Liquibase.

If you are using the JEE CDI Integration for Liquibase, you can use --should-run to stop Liquibase from performing updates when the CDI container boots.

If you are making test runs of an application, you can also use --should-run to enable Liquibase commands on application startup but disable it on test runs.

Syntax

You can set this parameter in the following ways:

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

JVM system property (JAVA_OPTS Environment Variable)

JAVA_OPTS=-Dliquibase.shouldRun=<true|false>
Liquibase Environment Variables
LIQUIBASE_SHOULD_RUN=<true|false>

For more information, see Working with Command Parameters.

Output

If you run Liquibase with --should-run set to false, the output is:

Liquibase did not run because 'liquibase.shouldRun' was set to false