syncHub command

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


The syncHub command is typically used when you want to:

  • Ensure that Liquibase Hub shows the latest results from your DATABASECHANGELOG table.
  • Synchronize the DATABASECHANGELOG table of a new project that has pre-existing data in the DATABASECHANGELOG table.
  • Synchronize your local data if update, rollback, changelogSync, or dropAll were run while Liquibase Hub was offline.

When you run the syncHub command, you will not see any operations added to the Project associated with your changelog. syncHub cannot associate previous Liquibase operations, so you will not see any operations in Liquibase Hub. You will only see changesets added to the changesets tab in your Liquibase Hub project.

Running the syncHub command

To run the syncHub command, you need to specify your driver, class path, URL, and user authentication information in your file. For more information, see Creating and configuring a 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 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
  • The first time you run the syncHub command, Liquibase Hub doesn’t know what your connection is. Therefore, add the --changeLogFile attribute to the syncHub command.

  • The hubConnectionId attribute
  • If you entered the changeLogFile attribute, there is no need to specify hubConnectionId with the command. If you use hubConnectionId, add it to the syncHub command on the command line.

    liquibase syncHub --hubConnectionId=myConnectionId

    Note: You can find the hubConnectionId in Project > Connections > Connection in the lower-left corner.

  • The registerChangeLog command
  • Before running the syncHub command, register your changelog file by using the registerChangeLog command:

    liquibase --changeLogFile=mychangelog.xml registerChangeLog

    The registerChangeLog command connects your local Liquibase activity to a specific Liquibase Hub Project.

    Next, run the syncHub command:

    liquibase syncHub

syncHub command attributes

Attribute Definition Requirement


Specifies the connection needed for the syncHub command to synchronize the local DATABASECHANGELOG table with Liquibase Hub.



C:\dev\DaticalDB-testing\liquibase-pro-cli-project\oracle_lbpro_master>..\liquibase --changeLogFile=oracle_lbpro_master_changelog.xml syncHub
Starting Liquibase at 15:23:41 (version 4.0.1-DAT-4987-SNAPSHOT #6 built at 2020-08-31 21:09+0000)
Liquibase command 'syncHub' was executed successfully.