Using Commands in Liquibase Hub

When you use Liquibase Community or Liquibase Pro commands that make changes to your database, the data is sent to Liquibase Hub. Running commands like update, rollback, changelogSync, and dropAll are recorded by Liquibase Hub and are available for review as Operation reports. For more information, see Liquibase Hub Operations.

Liquibase Hub tracks the following commands:

Also, there are two commands specific to Liquibase Hub functionality:

Note: If you use Maven, refer to the Maven registerChangeLog and Maven syncHub documentation to configure the Maven pom.xml file and another required properties.

The registerChangeLog command connects your local Liquibase activity to a specific Liquibase Hub Project. By registering your changelog, this activity will be visible only to one Project within one Organization in Liquibase Hub.

The syncHub command synchronizes the local DATABASECHANGELOG table with Liquibase Hub.

Note: To run the syncHub command for a non-unique URL, specify either the hubConnectionId or the registered changelog file. To run the registerChangeLog in the non-interactive mode, specify the hubConnectionId.

Prerequisites

To run the commands, specify your driver, class path, URL, and user authentication information in your liquibase.properties file. For more information, see Creating and configuring a liquibase.properties file. You can also specify these properties in your command line.

For the Liquibase CLI app and Liquibase Hub, the following items are required:

  • The Liquibase Hub API Key
  • There are three ways to specify your API Key:

    • Including liquibase.hub.ApiKey value in the liquibase.properties file:
    • liquibase.hub.ApiKey: <addYourHubApiKeyHere>
    • Passing liquibaseHubApiKey on the command line:
    • -- liquibaseHubApiKey=addYourHubApiKeyHere
    • Specifying API key in your JAVA_OPTS as -Dliquibase.hub.apiKey. To specify JAVA_OPTS on Windows, Linux, or MacOS, run SET JAVA_OPTS=”-Dliquibase.hub.apikey”
    • Note: To retrieve or manage your API keys, go to Settings > API Keys by selecting the settings icon on the left side of the page.

  • The registered changelog file
    • Run the registerChangeLog command to connect an XML or formatted SQL changelog (additional changelog formats coming soon) to a specific Liquibase Hub Project. Liquibase Hub relies on a new unique identifier in your changelog called changeLogId, which is automatically added by the registerChangeLog command to provide the real-time monitoring and reports.

      Note: If you use a nested changelog structure, register only the master changelog without registering the nested changelogs. For more information about nested changelogs, see Liquibase Best Practices. You can register a changelog to an existing project or create a new one from the CLI as well.

    • Once the changelogId identifier is added to your changelog, make sure to commit the changelog to source control, so all team members’ changes are recorded in Liquibase Hub and the same changelog is not registered with Liquibase Hub multiple times.

The level of data you want to send to Liquibase Hub. If you set liquibase.hub.mode=off, you won’t receive any data in Liquibase Hub when running the commands.

liquibase.hub.mode:[all=default|meta|off]
  • all sends all data, including the changeset body, generated SQL, and logs (default)
  • meta does not send the changeset body, generated SQL, or operation-event and change-event logs
  • off does not send any data to Liquibase Hub

Each command automatically synchronizes the local DATABASECHANGELOG table with Liquibase Hub.

If you follow all the prerequisites, you can use Liquibase Hub to see what changesets passed and what failed in your update, rollback, changelogSync, or dropAll (coming soon) operations. You can see these Operation reports filtered to a specific Project, database connection, or by dates and users.

See also

Next up:

Liquibase Hub Operations