init hub

The init hub subcommand connects your local Liquibase activity to Liquibase Hub with an API key and sets up the Liquibase environment to use Liquibase Hub.

Uses

If you are new to Liquibase, the init hub subcommand will create and add Liquibase project files for you by calling the init project subcommand.

If you already use Liquibase and want to connect to the existing files with Liquibase Hub, the init hub subcommand detects the changelog and properties files with the help of the --project-dir parameter, and registers the changelog to a Liquibase Hub Project.

Running the init hub subcommand

The init hub subcommand takes two parameters to run:

  • --token – the code required to connect local Liquibase activity with Liquibase Hub.
  • --project-dir – the relative or fully qualified path to the directory where the project files are or will be created. Set the parameter as an environment variable, Java system property, or in the Liquibase properties file:
    • Environment variable: LIQUIBASE_COMMAND_INIT_PROJECT_PROJECT_DIR
    • Liquibase properties file: liquibase.command.init.project.projectDir
    • Java system property, which is set at the command prompt:

      Example: For Windows: SET JAVA_OPTS="liquibase.command.init.project.projectDir=java_lbproj"
      For Linux: -Dliquibase.command.init.project.projectDir=java_lbproj

From the command prompt or terminal, run the following command and follow the CLI instructions:

liquibase init hub --token=<the token you see in the Liquibase Hub Getting Started dialog>

To connect your existing Liquibase project files, add the --project-dir parameter:

liquibase init hub --token=<the token you see in the Liquibase Hub Getting Started dialog> 
--project-dir=<the/path/to/a/directory>