register-changelog

The register-changelog 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

Use the register-changelog command to connect an XML, SQL, JSON, or YAML changelog to your Liquibase Hub Project.

Note: JSON and YAML changelog formats are available in Liquibase 4.2.1 and later versions.

The command 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 register-changelog command to provide real-time monitoring and reports.

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

Note: If you follow a root changelog structure, register only the root changelog without registering the nested changelogs. For more information about the structure, see Best Practices.

Running the register-changelog command

To run the register-changelog command, specify the following parameters in the Liquibase properties file, environment variables, or the command prompt while running the command:

Tip: For more information about the options to store parameters, see Create and Configure a liquibase.properties File, Liquibase Environment Variables, and JAVA_OPTS Environment Variable. To find the format of the parameter, see Command Parameters.

Run the register-changelog command:

liquibase register-changelog --changelog-file=exampleChangelog.sql

Note: Replace exampleChangelog.sql above with your changelog file title before running the command.

Non-interactive register-changelog

To run the register-changelog in the non-interactive mode, specify the --hubProjectId, which is located in Projects > View Details for the required project > Operations or any other tab of the project.

Tip: For best results, specify all commands and parameters in the --kebab-case format in the CLI. If your preference is camelCase, it also works in the CLI.

If you specify both changelog and hubProjectId, the command will register the changelog to the specified project without showing the interactive prompt:

liquibase --changelog-file=mychangelog.xml register-changelog --hubProjectId=myProjectId

The Maven register-changelog goal also runs in the non-interactive mode. For more information, see Maven registerChangeLog.

Tip: Process and synchronize your source and target resources to ensure you use your newly registered changelog to report operations to Liquibase Hub.