About Liquibase Commands

Liquibase ships with more than 40 commands providing users the ability to execute database change management operations.

Commands are typically categorized by their functions such as database inspection, rolling back changes, database maintenance, and change tracking. Below are eight command categories:

Simplified icon of a stopwatch

Init

Commands used to start up a Liquibase project on a new or existing database, including the changelog and Liquibase property files.

Simplified icon of a database stack with a "plus" sign at the bottom

Update

Commands used to execute undeployed changes specified in the changelog to a target database.

Simplified icon of a database stack with a "return" arrow at the bottom

Rollback

Commands used to undo changes made to the database either automatically or with a custom rollback query.

Simplified icon of a database stack with an arrow pointing right and one beneath it pointing left, all under a magnifying glass

Database Inspection

Commands used to compare differences between databases, or snapshots of databases over time.

Simplified icon of a gear connected by lines to three cubes on the left and right, representing data

Change Tracking

Commands used to view or list the deployment status of changes.

Simplified icon of a shipping box with code syntax printed on the near side

Utility

Commands used to manage changelogs, changesets, checksums, locks, and database schema documents.

Simplified icon of a shield, resembling a police badge, with a star in the center

Quality Checks

Commands that allow users to analyze changelogs, changesets, and SQL for specific commands and patterns that require close review early in the development life cycle. Requires a Liquibase Pro license.

Simplified icon of a gear encircled by an arrow showing its direction of rotation (anti-clockwise)

Flow

Commands that allow users to group multiple Liquibase commands in a single file and run sequentially by typing one command in the CLI. Requires a Liquibase Pro license.

Liquibase SQL Output Commands

Liquibase provides commands that output the SQL Liquibase will generate from a modeled database change so users can inspect the SQL before executing a command. Only commands that change the database schema (including the update and rollback family of commands) have a corresponding Liquibase SQL output command.

Users are strongly encouraged to run these commands when they are available.

Executing Liquibase Commands

Liquibase commands can be executed through different types of interfaces for database change management. These include:

  • Command-line interface (CLI)
  • Liquibase flow files (Pro)
  • Maven
  • Spring Boot
  • Java API

Command Parameters

Liquibase command parameters let users specify behavior when running Liquibase commands and are either global parameters or command parameters:

  • Global parameters are used to change a global default behavior and can be used with any Liquibase command.
  • Command parameters specify command-specific settings and values.

Typical command pattern:

liquibase [global parameter] [command] [command parameter]
liquibase [--changelog-file=dbchangelog.xml] [status] [--verbose]

Parameter values may include booleans, strings, integers, datetimes, and other data types.

Required Command Parameters

Certain parameters are required to execute most commands. These include:

  • --changelog-file: includes the path and filename of the changelog used.
  • --url: the database JDBC URL value.
  • --username*: the database username value.
  • --password*: the password for the database.

Not all commands require the same command parameters. Each individual command page provides the criteria for using the command successfully with a list of available global and command-specific parameters.

* It is strongly recommended that credentials be stored in a secure credential repository or entered in the CLI at runtime.

Specifying Command Properties

Liquibase provides users multiple ways to specify command properties:

  • Command Line Interface (CLI): specifying parameters in the CLI will override values stored in the Liquibase properties file. See Working with Command Parameters.
  • Flow File Parameters (Liquibase Pro): similar to specifying parameters in the CLI. Flow file parameters will override values stored in the Liquibase properties file. See Liquibase Flow Files.
  • Liquibase Properties File: used to store frequently used properties including the path to the changelog and database connection information. Also called the "defaults file." See Create and Configure a liquibase.properties File.
  • Environment Variables: used to set global and command-specific Liquibase properties across multiple environments. See Liquibase Environment Variables.
  • Java System Properties: uses the JAVA_OPTS environment variable to pass Liquibase configuration properties to the Java Virtual Machine (JVM) that runs Liquibase. See JAVA_OPTS Environment Variable.
  • Maven Properties: uses a POM file (pom.xml) to specify properties and configuration settings to run Liquibase or to reference the Liquibase properties file. See Maven Properties.

Additional Information

CLI Command Syntax

Liquibase provides several methods for the CLI command syntax to match a user's work style:

  • kebab-case: --kebab-case-example
  • camelCase: --camelCaseExample

The Liquibase Documentation site uses the kebab-case format.

Note: If you specify parameters outside the CLI, such as with an environment variable, the syntax is different. You can use the links in the previous section to find examples.

Autocomplete Option for Commands

Visit the Autocompleting Liquibase Commands documentation page to learn more about this feature.

Liquibase Command List

For a complete list of all available Liquibase commands, including their specific parameters: