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
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 three commands specific to Liquibase Hub functionality:
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.
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
deactivateChangeLog command removes the
changelogID from your changelog file so it stops sending reports to Liquibase Hub.
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
liquibase.hub.ApiKeyvalue in the
There are three ways to specify your API Key:
liquibaseHubApiKeyon the command line:
- Specifying API key in your JAVA_OPTS Environment Variable as
- On Linux or MacOS:
- On Windows:
- On Linux or MacOS:
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
registerChangeLogcommand to connect an XML or formatted SQL changelog to a specific Liquibase Hub Project. Also, you can use JSON and YAML changelog formats (since 4.2.1). Liquibase Hub relies on a new unique identifier in your changelog called
changeLogId, which is automatically added by the
registerChangeLogcommand 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
changelogIdidentifier 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.
- Run the
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.
allsends all data, including the changeset body, generated SQL, and logs (default)
metadoes not send the changeset body, generated SQL, or operation-event and change-event logs
offdoes 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
dropAll (coming soon) operations. You can see these Operation reports filtered to a specific Project, database target, or by dates and users.