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.
registerChangeLog command is used to connect an XML or formatted SQL changelog to your Liquibase Hub Project. Also, you can use JSON and YAML changelog formats (since 4.2.1).
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.
To run the
registerChangeLog command, you can specify your driver, classpath, 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
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 as
-Dliquibase.hub.apiKey. To specify JAVA_OPTS on Windows, Linux, or MacOS, run
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
To run the
registerChangeLog in the non-interactive mode, specify the
--hubProjectId, which is located in Project > Operations.
If you specify both changelog and
hubProjectId, the command will register the changelog to the specified project without showing the interactive prompt:
liquibase --changeLogFile=mychangelog.xml registerChangeLog --hubProjectId=myProjectId
Note: If you want to run the
registerChangeLog Maven goal, you must use the non-interactive version of the goal. This means that in addition to the
hubApiKey, you need to specify the
hubProjectId of an existing Liquibase Hub Project in your Maven
pom.xml. Also, as you cannot create a new project in Maven, create a Liquibase Hub Project with the CLI before registering a changelog with Maven.
When running the
registerChangeLog command, you will be prompted to select an existing project, create a new one, or not to register right now.
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  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.