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 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>

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

Syntax

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

When using the CLI to specify arguments, 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.

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, 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