liquibase-schema-name parameter

The liquibase-schema-name global parameter is a string that specifies the schema to use for the creation of Liquibase objects, like the DATABASECHANGELOG and DATABASECHANGELOGLOCK tracking tables.

Uses

If you are working in a multi-schema project, you can use liquibase-schema-name to separate the DATABASECHANGELOG and DATABASECHANGELOGLOCK tables from other Liquibase objects. This way, you will have a tracking schema and one or more managed schemas.

If you need to work in a test schema for your project, you can set liquibase-schema-name to control where Liquibase looks for the tracking tables during test runs.

Setting the liquibase-schema-name parameter

You can set liquibase-schema-name in four ways:

  • As a JVM system property
  • In your liquibase.properties file
  • As a global parameter in the CLI
  • As an environment variable (Liquibase Pro)

If you do not set liquibase-schema-name, Liquibase will put the tracking tables in the schema defined by default-schema-name. The default value of default-schema-name varies per database.

Java system property

You can set liquibase-schema-name as a Java system property from your command line:

java -Dliquibase.schemaName=YOUR_SCHEMA_NAME

You can also set it with the JAVA_OPTS Environment Variable. The syntax on Mac/Linux is as follows:

JAVA_OPTS=-Dliquibase.schemaName=YOUR_SCHEMA_NAME && liquibase update --changelog-file=dbchangelog.xml

The syntax on Windows requires the set command:

set JAVA_OPTS=-Dliquibase.schemaName=YOUR_SCHEMA_NAME && liquibase update --changelog-file=dbhangelog.xml

liquibase.properties parameter

In Liquibase 4.1+, you can set liquibase-schema-name by adding the following to your liquibase.properties file:

liquibase.liquibaseSchemaName: YOUR_SCHEMA_NAME

CLI global parameter

You can use liquibase-schema-name as a global parameter in your command line with a single Liquibase command, such as update:

liquibase --liquibase-schema-name=YOUR_SCHEMA_NAME update --changelog-file=dbchangelog.xml

Environment variable (Liquibase Pro)

If you use Liquibase Pro, you can set liquibase-schema-name as an environment variable. The syntax on Mac/Linux is as follows:

LIQUIBASE_LIQUIBASE_SCHEMA_NAME=YOUR_SCHEMA_NAME

The syntax on Windows requires the set command:

set LIQUIBASE_LIQUIBASE_SCHEMA_NAME=YOUR_SCHEMA_NAME

Note: The commands shown above only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.

Related links