Working with Command Parameters

To run Liquibase commands by using the CLI, follow the syntax rules in this topic and the --help output.

Locations

Command arguments are specified as either of the following types:

  • Global arguments provide a way to change an overall default behavior. Specified before the command, global arguments are neither part of nor specific to a particular command. Examples include log-level and catalog-name.
  • Command arguments 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 arguments after the command.

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

liquibase <global arguments> <command> <command arguments>

Liquibase parses additional arguments as command arguments but does not support the positional argument style in which unnamed arguments follow the command. For example, Liquibase supports git pull --remote=origin but not git pull origin.

Syntax

To avoid conflicts between extensions, namespaces are associated with global and command arguments. Liquibase settings, Liquibase uses the liquibase namespace in the defaults file liquibase.log-level.

When using the CLI to specify arguments, drop the --liquibase- portion, like --log-level.

Tip: All commands and parameters use the --kebab-case format in the CLI environment. This is the format Liquibase recommends for best results. If your preference is camelCase, it will still work in the CLI.

Argument Keys and Values

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

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

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

Example: --url jdbc:h2:/mem

Multi-Word Arguments

Some arguments consists of multiple words, such as the reference URL and reference username. When constructing multi-word arguments, 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 argument

Configuration Hierarchy

Liquibase supports the setting of properties from the following locations:

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

This list is arranged hierarchically, with initial (higher) locations taking priority over later (lower) ones. 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