Working with Command Parameters

To run Liquibase commands by using the CLI, follow the syntax rules in this topic and the --help output. For a list of parameters, see Liquibase Parameters.

Locations

Command parameters are specified as either of the following types:

  • Global parameters provide a way to change an overall default behavior. Specified before the command, global parameters are neither part of nor specific to a particular command. Examples include --log-level and --catalog-name.
  • Command parameters specify command settings and are sometimes required for a particular command. Examples of command settings include --changelog-file, --password, --username, and --reference-url. Specify command parameters after the command.

The following example shows the appropriate positioning of global and command parameters with respect to the command.

liquibase <global parameters> <command> <command parameters>

Note: Liquibase version 4.4 turned some global parameters into command parameters. Pre-4.4 syntax is supported in 4.4+ versions.

Syntax

To avoid conflicts between extensions, namespaces are associated with global and command parameters. For Liquibase settings, Liquibase uses the liquibase namespace in the defaults file, for example liquibase.logLevel.

When using the CLI to specify paramters, drop the liquibase. portion, for example --log-level.

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.

Parameter keys and values

Use the equal sign (=) to assign values to parameters.

Example: --url=jdbc:h2:/mem

Alternatively, you can use a space to assign a value to an parameter.

Example: --url jdbc:h2:/mem

Multi-word parameters

Some parameters consists of multiple words, such as the reference URL and reference username. When constructing multi-word parameters, use the following syntax guidelines, even if examples present them as camelCased variants:

  • Use a dash (-) to separate words
  • Use lowercase letters, like --reference-url
  • Do not insert spaces or multiple dashes in a global or command parameter

Configuration hierarchy

Liquibase supports the setting of properties from the following locations, from highest to lowest priority:

  1. Command-line arguments
  2. ServletConfig initialization parameters
  3. ServletContext initialization parameters
  4. Java system properties
  5. OS environment variables
  6. Configuration data, such as piped standard input, defaults files, and connection profiles and other properties stored in the Liquibase properties file.

For example, command-line arguments override ServletConfig and ServletContext initialization parameters, Java system properties, OS environment variables, and configuration data, while OS environment variables override configuration data only.

Related links