registerChangeLog command

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.

Uses

The registerChangeLog command is used to connect an XML or formatted SQL changelog to your Liquibase Hub Project. (Additional changelog formats coming soon!)

The command also assigns the changeLogId to the changelog file that you register. The changeLogId is a unique identifier in your changelog, which is automatically added by the registerChangeLog command to provide real-time monitoring and reports.

You can connect the needed changelog file with your existing project or create a new project from the CLI.

Note: If you follow a master changelog structure, register only the master changelog without registering the nested changelogs.

Running the registerChangeLog command

To run the registerChangeLog command, you need to 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.

Also, 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=<myapikey>”
    • 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 changelog file
  • Add your changelog file to the liquibase.properties file or specify it as the --changeLogFile attribute while running the command.

    Next, run the registerChangeLog command:

    liquibase registerChangeLog

    Note: To run the registerChangeLog in the non-interactive mode, specify the --hubConnectionId, which is located in Connections.

Output

When running the registerChangeLog command, you will be prompted to select an existing project, create a new one, or not to register right now.

Note: If you specify both changelog and hubProjectId, the command will register the changelog to the specified project without showing the interactive prompt: hubProjectId liquibase --changeLogFile=mychangelog.xml registerChangeLog --hubProjectId=myProjectId You can find the hubProjectId in Project > Operations.

Starting Liquibase at 10:28:48 (version 4.0.1-DAT-4800-SNAPSHOT #17 built at 2020-07-30 22:13+0000)
Registering a changelog connects Liquibase operations to a Project for monitoring and reporting.
Register changelog <changelogfilename> to an existing Project, or create a new one.
Please make a selection:
[C] Create new Project
[1] bbb-hub’s Project project (Project ID:f12345abc-67d9-10ef1-213g-141567kl89m) 2020-07-31 15:25:12.777825
[N] to not register this changelog right now.
You can still run Liquibase commands, but no data will be saved in your Liquibase Hub account for monitoring or reports.
Learn more at https://docs.liquibase.com.
?>

If you select the existing project, enter its number to the ?> in the current output or select C to create a new project.

?>1
Changelog file ‘changelog-bbb_master.xml’ has been registered with changelog ID ‘0b0e00e1-9145-9149-8bd3-bdc91958411e’ and connected to project ‘bbb-hub’s Project project’ with project ID ‘f12345abc-67d9-10ef1-213g-141567kl89m’
Liquibase command ‘registerChangeLog’ was executed successfully.