diff

The diff command in Liquibase allows you to compare two databases of the same type, or different types, to one another.

Uses

The diff command is typically used at the completion of a project to verify all expected changes are in the changelog or to detect drift between a model schema and a database's actual schema. The diff command is also useful for the following tasks:

  • Finding missing objects between one database and another
  • Seeing that a change was made to your database
  • Finding unexpected items in your database

In Liquibase Pro 4.25.0 and later, you can use diff to seamlessly generate a Drift Report for your databases.

Syntax

Running the diff  command requires two URLs:

  • reference-url – the source for the comparison. The --reference-url attribute represents your source (reference) database, which is the basis for the database you want to compare.
  • url – the target of the comparison. The --url attribute represents your target database, which you want to compare to the source (reference) database. You typically perform actions and run commands on this database.

To compare two databases:

  • Option 1: Run the diff command with all necessary attributes in the CLI:
  • liquibase diff 
    --url="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
    --username=<USERNAME>
    --password=<PASSWORD>
    --reference-url="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
    --reference-username=<USERNAME>
    --reference-password=<PASSWORD>

    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.

    See the snapshot command topic for an example of using a snapshot file as one of the databases being used in the command.

    Tip: Liquibase recommends that you place your database's JDBC driver JAR file in the liquibase/lib directory. If you place the driver file in a different directory, specify the path in the properties file: classpath:../<path-to-drivers>/ojdbc<version>.jar. For more information, see Create and Configure a liquibase.properties File. When you run the diff command against two databases, either the drivers for both must be in the liquibase/lib directory or the classpath property must reference both JAR files. Use the appropriate path separator for your operating system: for Windows, use a semicolon; for Mac or Linux, use a colon.

    Example: classpath: ojdbc7.jar:postgresql-42.2.8.jar

By default, the result is sent to STDOUT, which provides flexibility to use the result in other tools or in a processing pipeline. You can also have your output in a file using the --output-file=<filename> attribute.

liquibase diff --output-file=myfile.json 

The diff command produces a list of diff types, along with one of the following descriptions:

  • Missing: there are objects on your source database (referenceURL) that are not on your target database (URL).
  • Unexpected: there are objects on your target database (URL) that are not on your source database (referenceURL).
  • Changed: the object as it exists on the source database (referenceURL) is different than as it exists in the target database (URL).

Note: The changed description will not specify the type of change applied to your database. Run the diff-changelog command to generate a changelog that will apply the changes to the target database.

Liquibase Open Source diff types:

  • Catalog
  • Column
  • Foreign Key
  • Index
  • Primary Key
  • Schema
  • Sequence
  • Unique Constraints
  • View

Liquibase Pro diff types:

  • Check Constraint
  • Package
  • Package Body
  • Procedure
  • Function
  • Trigger
  • Synonyms

Note: Liquibase does not currently check datatype length.

Filtering diff types

Liquibase allows you to use diff-types attribute to filter the types of objects you want to compare. Multiple filters can be added to the attribute as a comma-separated list. If no diff-types are specified, all objects are considered.

Example: liquibase diff --diff-types=tables,indexes,views

Command arguments

Attribute Definition Requirement

--reference-url=<string>

The JDBC reference database connection URL

Required

--url=<string>

The JDBC database connection URL. See Using JDBC URL in Liquibase.

Required

--default-catalog-name=<string>

Name of the default catalog to use for the database connection

Optional

--default-schema-name=<string>

Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional

--diff-types=<string>

Specifies the types of objects to compare. Specify multiple values as a comma-separated list (without spaces). Valid values are: catalogs, checkconstraints, columns, data, databasepackage, databasepackagebody, foreignkeys, functions, indexes, primarykeys, sequences, storedprocedures, triggers, uniqueconstraints, views.

If null, default types are columns, foreignkeys, indexes, primarykeys, tables, uniqueconstraints, views.

Note: The diff types checkconstraints, databasepackage, databasepackagebody, functions, storedprocedures, and triggers require a valid Liquibase Pro license key to use.

Optional

--drift-severity=<string>

Specifies the severity level of all error types in the drift report (changed, missing, or unexpected content). Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. If both --drift-severity and one of the individual error type arguments are set, the individual error type arguments take priority. Default: INFO.

Optional

--drift-severity-changed=<string>

Specifies the severity level of changed content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for changed content only. Default: INFO.

Optional

--drift-severity-missing=<string>

Specifies the severity level of missing content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for missing content only. Default: INFO.

Optional

--drift-severity-unexpected=<string>

Specifies the severity level of unexpected content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for unexpected content only. Default: INFO.

Optional

--driver=<string>

The JDBC driver class

Optional

--driver-properties-file=<string>

The JDBC driver properties file

Optional

--exclude-objects=<string>

Objects to exclude from diff

Optional

--format=<string>

Option to create JSON output. See diff JSON.

Optional

--include-objects=<string>

Objects to include in diff

Optional

--open-report=<true|false>

If true, automatically opens the report in your default browser. Default: false.

Optional

--output-schemas=<string>

Lets you replace the schemas in the output changelog. This is a CSV list. The parameter size must match --schemas. If you have three items names in --schemas, you must also have three items in --output-schemas.

Example: liquibase generate-changelog --schemas=a,b,c --output-schemas=d,e,f

Optional

--password=<string>

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

--reference-default-catalog-name=<string>

The reference default catalog name to use for the database connection

Optional

--reference-default-schema-name=<string>

The reference default schema name to use for the database connection

Optional

--reference-driver=<string>

The JDBC driver class for the reference database

Optional

--reference-driver-properties-file=<string>

The JDBC driver properties file for the reference database

Optional

--reference-liquibase-catalog-name=<string>

Reference database catalog to use for Liquibase objects. Liquibase 4.24.0+.

Optional

--reference-liquibase-schema-name=<string>

Reference database schema to use for Liquibase objects. Liquibase 4.24.0+.

Optional

--reference-password=<string>

The reference database password.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

--reference-schemas=<string>

Schemas names on reference database to use in diff. This is a CSV list.

Optional

--reference-username=<string>

The reference database username.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

--report-enabled=<true|false>

Enables a report at the command level. Overrides the global argument --reports-enabled. Default: false.

Optional

--report-name=<string>

Specifies the name of the report file at the command level. Overrides the global argument --reports-name. By default, Liquibase generates a new report file labeled with a timestamp (user's local time). If you set a custom name, Liquibase overwrites the existing file every time you generate a new report. Default: report-<DD-Mon-YYYY-HHmmss>.html.

Optional

--report-path=<string>

Specifies the file path to the report file at the command level. Overrides the global argument --reports-path. Default: ./.

Optional

--schemas=<string>

Schemas to include in diff

Optional

--username=<string>

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional
Attribute Definition Requirement

cmdArgs: { reference-url: "<string>" }

The JDBC reference database connection URL

Required

cmdArgs: { url: "<string>" }

The JDBC database connection URL. See Using JDBC URL in Liquibase.

Required

cmdArgs: { default-catalog-name: "<string>" }

Name of the default catalog to use for the database connection

Optional

cmdArgs: { default-schema-name: "<string>" }

Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional

cmdArgs: { diff-types: "<string>" }

Specifies the types of objects to compare. Specify multiple values as a comma-separated list (without spaces). Valid values are: catalogs, checkconstraints, columns, data, databasepackage, databasepackagebody, foreignkeys, functions, indexes, primarykeys, sequences, storedprocedures, triggers, uniqueconstraints, views.

If null, default types are columns, foreignkeys, indexes, primarykeys, tables, uniqueconstraints, views.

Note: The diff types checkconstraints, databasepackage, databasepackagebody, functions, storedprocedures, and triggers require a valid Liquibase Pro license key to use.

Optional

cmdArgs: { drift-severity: "<string>" }

Specifies the severity level of all error types in the drift report (changed, missing, or unexpected content). Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. If both --drift-severity and one of the individual error type arguments are set, the individual error type arguments take priority. Default: INFO.

Optional

cmdArgs: { drift-severity-changed: "<string>" }

Specifies the severity level of changed content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for changed content only. Default: INFO.

Optional

cmdArgs: { drift-severity-missing: "<string>" }

Specifies the severity level of missing content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for missing content only. Default: INFO.

Optional

cmdArgs: { drift-severity-unexpected: "<string>" }

Specifies the severity level of unexpected content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for unexpected content only. Default: INFO.

Optional

cmdArgs: { driver: "<string>" }

The JDBC driver class

Optional

cmdArgs: { driver-properties-file: "<string>" }

The JDBC driver properties file

Optional

cmdArgs: { exclude-objects: "<string>" }

Objects to exclude from diff

Optional

cmdArgs: { format: "<string>" }

Option to create JSON output. See diff JSON.

Optional

cmdArgs: { include-objects: "<string>" }

Objects to include in diff

Optional

cmdArgs: { open-report: "<true|false>" }

If true, automatically opens the report in your default browser. Default: false.

Optional

cmdArgs: { output-schemas: "<string>" }

Lets you replace the schemas in the output changelog. This is a CSV list. The parameter size must match --schemas. If you have three items names in --schemas, you must also have three items in --output-schemas.

Example: liquibase generate-changelog --schemas=a,b,c --output-schemas=d,e,f

Optional

cmdArgs: { password: "<string>" }

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

cmdArgs: { reference-default-catalog-name: "<string>" }

The reference default catalog name to use for the database connection

Optional

cmdArgs: { reference-default-schema-name: "<string>" }

The reference default schema name to use for the database connection

Optional

cmdArgs: { reference-driver: "<string>" }

The JDBC driver class for the reference database

Optional

cmdArgs: { reference-driver-properties-file: "<string>" }

The JDBC driver properties file for the reference database

Optional

cmdArgs: { reference-liquibase-catalog-name: "<string>" }

Reference database catalog to use for Liquibase objects. Liquibase 4.24.0+.

Optional

cmdArgs: { reference-liquibase-schema-name: "<string>" }

Reference database schema to use for Liquibase objects. Liquibase 4.24.0+.

Optional

cmdArgs: { reference-password: "<string>" }

The reference database password.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

cmdArgs: { reference-schemas: "<string>" }

Schemas names on reference database to use in diff. This is a CSV list.

Optional

cmdArgs: { reference-username: "<string>" }

The reference database username.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

cmdArgs: { report-enabled: "<true|false>" }

Enables a report at the command level. Overrides the global argument --reports-enabled. Default: false.

Optional

cmdArgs: { report-name: "<string>" }

Specifies the name of the report file at the command level. Overrides the global argument --reports-name. By default, Liquibase generates a new report file labeled with a timestamp (user's local time). If you set a custom name, Liquibase overwrites the existing file every time you generate a new report. Default: report-<DD-Mon-YYYY-HHmmss>.html.

Optional

cmdArgs: { report-path: "<string>" }

Specifies the file path to the report file at the command level. Overrides the global argument --reports-path. Default: ./.

Optional

cmdArgs: { schemas: "<string>" }

Schemas to include in diff

Optional

cmdArgs: { username: "<string>" }

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional
Attribute Definition Requirement

liquibase.command.referenceUrl: <string>

liquibase.command.<cmdName>.referenceUrl: <string>

The JDBC reference database connection URL

Required

liquibase.command.url: <string>

liquibase.command.<cmdName>.url: <string>

The JDBC database connection URL. See Using JDBC URL in Liquibase.

Required

liquibase.command.defaultCatalogName: <string>

liquibase.command.<cmdName>.defaultCatalogName: <string>

Name of the default catalog to use for the database connection

Optional

liquibase.command.defaultSchemaName: <string>

liquibase.command.<cmdName>.defaultSchemaName: <string>

Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional

liquibase.command.diffTypes: <string>

liquibase.command.<cmdName>.diffTypes: <string>

Specifies the types of objects to compare. Specify multiple values as a comma-separated list (without spaces). Valid values are: catalogs, checkconstraints, columns, data, databasepackage, databasepackagebody, foreignkeys, functions, indexes, primarykeys, sequences, storedprocedures, triggers, uniqueconstraints, views.

If null, default types are columns, foreignkeys, indexes, primarykeys, tables, uniqueconstraints, views.

Note: The diff types checkconstraints, databasepackage, databasepackagebody, functions, storedprocedures, and triggers require a valid Liquibase Pro license key to use.

Optional

liquibase.command.driftSeverity: <string>

liquibase.command.<cmdName>.driftSeverity: <string>

Specifies the severity level of all error types in the drift report (changed, missing, or unexpected content). Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. If both --drift-severity and one of the individual error type arguments are set, the individual error type arguments take priority. Default: INFO.

Optional

liquibase.command.driftSeverityChanged: <string>

liquibase.command.<cmdName>.driftSeverityChanged: <string>

Specifies the severity level of changed content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for changed content only. Default: INFO.

Optional

liquibase.command.driftSeverityMissing: <string>

liquibase.command.<cmdName>.driftSeverityMissing: <string>

Specifies the severity level of missing content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for missing content only. Default: INFO.

Optional

liquibase.command.driftSeverityUnexpected: <string>

liquibase.command.<cmdName>.driftSeverityUnexpected: <string>

Specifies the severity level of unexpected content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for unexpected content only. Default: INFO.

Optional

liquibase.command.driver: <string>

liquibase.command.<cmdName>.driver: <string>

The JDBC driver class

Optional

liquibase.command.driverPropertiesFile: <string>

liquibase.command.<cmdName>.driverPropertiesFile: <string>

The JDBC driver properties file

Optional

liquibase.command.excludeObjects: <string>

liquibase.command.<cmdName>.excludeObjects: <string>

Objects to exclude from diff

Optional

liquibase.command.format: <string>

liquibase.command.<cmdName>.format: <string>

Option to create JSON output. See diff JSON.

Optional

liquibase.command.includeObjects: <string>

liquibase.command.<cmdName>.includeObjects: <string>

Objects to include in diff

Optional

liquibase.command.openReport: <true|false>

liquibase.command.<cmdName>.openReport: <true|false>

If true, automatically opens the report in your default browser. Default: false.

Optional

liquibase.command.outputSchemas: <string>

liquibase.command.<cmdName>.outputSchemas: <string>

Lets you replace the schemas in the output changelog. This is a CSV list. The parameter size must match --schemas. If you have three items names in --schemas, you must also have three items in --output-schemas.

Example: liquibase generate-changelog --schemas=a,b,c --output-schemas=d,e,f

Optional

liquibase.command.password: <string>

liquibase.command.<cmdName>.password: <string>

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

liquibase.command.referenceDefaultCatalogName: <string>

liquibase.command.<cmdName>.referenceDefaultCatalogName: <string>

The reference default catalog name to use for the database connection

Optional

liquibase.command.referenceDefaultSchemaName: <string>

liquibase.command.<cmdName>.referenceDefaultSchemaName: <string>

The reference default schema name to use for the database connection

Optional

liquibase.command.referenceDriver: <string>

liquibase.command.<cmdName>.referenceDriver: <string>

The JDBC driver class for the reference database

Optional

liquibase.command.referenceDriverPropertiesFile: <string>

liquibase.command.<cmdName>.referenceDriverPropertiesFile: <string>

The JDBC driver properties file for the reference database

Optional

liquibase.command.referenceLiquibaseCatalogName: <string>

liquibase.command.<cmdName>.referenceLiquibaseCatalogName: <string>

Reference database catalog to use for Liquibase objects. Liquibase 4.24.0+.

Optional

liquibase.command.referenceLiquibaseSchemaName: <string>

liquibase.command.<cmdName>.referenceLiquibaseSchemaName: <string>

Reference database schema to use for Liquibase objects. Liquibase 4.24.0+.

Optional

liquibase.command.referencePassword: <string>

liquibase.command.<cmdName>.referencePassword: <string>

The reference database password.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

liquibase.command.referenceSchemas: <string>

liquibase.command.<cmdName>.referenceSchemas: <string>

Schemas names on reference database to use in diff. This is a CSV list.

Optional

liquibase.command.referenceUsername: <string>

liquibase.command.<cmdName>.referenceUsername: <string>

The reference database username.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

liquibase.command.reportEnabled: <true|false>

liquibase.command.<cmdName>.reportEnabled: <true|false>

Enables a report at the command level. Overrides the global argument --reports-enabled. Default: false.

Optional

liquibase.command.reportName: <string>

liquibase.command.<cmdName>.reportName: <string>

Specifies the name of the report file at the command level. Overrides the global argument --reports-name. By default, Liquibase generates a new report file labeled with a timestamp (user's local time). If you set a custom name, Liquibase overwrites the existing file every time you generate a new report. Default: report-<DD-Mon-YYYY-HHmmss>.html.

Optional

liquibase.command.reportPath: <string>

liquibase.command.<cmdName>.reportPath: <string>

Specifies the file path to the report file at the command level. Overrides the global argument --reports-path. Default: ./.

Optional

liquibase.command.schemas: <string>

liquibase.command.<cmdName>.schemas: <string>

Schemas to include in diff

Optional

liquibase.command.username: <string>

liquibase.command.<cmdName>.username: <string>

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional
Attribute Definition Requirement

JAVA_OPTS=-Dliquibase.command.referenceUrl=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceUrl=<string>

The JDBC reference database connection URL

Required

JAVA_OPTS=-Dliquibase.command.url=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.url=<string>

The JDBC database connection URL. See Using JDBC URL in Liquibase.

Required

JAVA_OPTS=-Dliquibase.command.defaultCatalogName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.defaultCatalogName=<string>

Name of the default catalog to use for the database connection

Optional

JAVA_OPTS=-Dliquibase.command.defaultSchemaName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.defaultSchemaName=<string>

Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional

JAVA_OPTS=-Dliquibase.command.diffTypes=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.diffTypes=<string>

Specifies the types of objects to compare. Specify multiple values as a comma-separated list (without spaces). Valid values are: catalogs, checkconstraints, columns, data, databasepackage, databasepackagebody, foreignkeys, functions, indexes, primarykeys, sequences, storedprocedures, triggers, uniqueconstraints, views.

If null, default types are columns, foreignkeys, indexes, primarykeys, tables, uniqueconstraints, views.

Note: The diff types checkconstraints, databasepackage, databasepackagebody, functions, storedprocedures, and triggers require a valid Liquibase Pro license key to use.

Optional

JAVA_OPTS=-Dliquibase.command.driftSeverity=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.driftSeverity=<string>

Specifies the severity level of all error types in the drift report (changed, missing, or unexpected content). Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. If both --drift-severity and one of the individual error type arguments are set, the individual error type arguments take priority. Default: INFO.

Optional

JAVA_OPTS=-Dliquibase.command.driftSeverityChanged=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.driftSeverityChanged=<string>

Specifies the severity level of changed content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for changed content only. Default: INFO.

Optional

JAVA_OPTS=-Dliquibase.command.driftSeverityMissing=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.driftSeverityMissing=<string>

Specifies the severity level of missing content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for missing content only. Default: INFO.

Optional

JAVA_OPTS=-Dliquibase.command.driftSeverityUnexpected=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.driftSeverityUnexpected=<string>

Specifies the severity level of unexpected content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for unexpected content only. Default: INFO.

Optional

JAVA_OPTS=-Dliquibase.command.driver=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.driver=<string>

The JDBC driver class

Optional

JAVA_OPTS=-Dliquibase.command.driverPropertiesFile=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.driverPropertiesFile=<string>

The JDBC driver properties file

Optional

JAVA_OPTS=-Dliquibase.command.excludeObjects=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.excludeObjects=<string>

Objects to exclude from diff

Optional

JAVA_OPTS=-Dliquibase.command.format=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.format=<string>

Option to create JSON output. See diff JSON.

Optional

JAVA_OPTS=-Dliquibase.command.includeObjects=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.includeObjects=<string>

Objects to include in diff

Optional

JAVA_OPTS=-Dliquibase.command.openReport=<true|false>

JAVA_OPTS=-Dliquibase.command.<cmdName>.openReport=<true|false>

If true, automatically opens the report in your default browser. Default: false.

Optional

JAVA_OPTS=-Dliquibase.command.outputSchemas=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.outputSchemas=<string>

Lets you replace the schemas in the output changelog. This is a CSV list. The parameter size must match --schemas. If you have three items names in --schemas, you must also have three items in --output-schemas.

Example: liquibase generate-changelog --schemas=a,b,c --output-schemas=d,e,f

Optional

JAVA_OPTS=-Dliquibase.command.password=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.password=<string>

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

JAVA_OPTS=-Dliquibase.command.referenceDefaultCatalogName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceDefaultCatalogName=<string>

The reference default catalog name to use for the database connection

Optional

JAVA_OPTS=-Dliquibase.command.referenceDefaultSchemaName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceDefaultSchemaName=<string>

The reference default schema name to use for the database connection

Optional

JAVA_OPTS=-Dliquibase.command.referenceDriver=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceDriver=<string>

The JDBC driver class for the reference database

Optional

JAVA_OPTS=-Dliquibase.command.referenceDriverPropertiesFile=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceDriverPropertiesFile=<string>

The JDBC driver properties file for the reference database

Optional

JAVA_OPTS=-Dliquibase.command.referenceLiquibaseCatalogName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceLiquibaseCatalogName=<string>

Reference database catalog to use for Liquibase objects. Liquibase 4.24.0+.

Optional

JAVA_OPTS=-Dliquibase.command.referenceLiquibaseSchemaName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceLiquibaseSchemaName=<string>

Reference database schema to use for Liquibase objects. Liquibase 4.24.0+.

Optional

JAVA_OPTS=-Dliquibase.command.referencePassword=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referencePassword=<string>

The reference database password.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

JAVA_OPTS=-Dliquibase.command.referenceSchemas=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceSchemas=<string>

Schemas names on reference database to use in diff. This is a CSV list.

Optional

JAVA_OPTS=-Dliquibase.command.referenceUsername=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.referenceUsername=<string>

The reference database username.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

JAVA_OPTS=-Dliquibase.command.reportEnabled=<true|false>

JAVA_OPTS=-Dliquibase.command.<cmdName>.reportEnabled=<true|false>

Enables a report at the command level. Overrides the global argument --reports-enabled. Default: false.

Optional

JAVA_OPTS=-Dliquibase.command.reportName=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.reportName=<string>

Specifies the name of the report file at the command level. Overrides the global argument --reports-name. By default, Liquibase generates a new report file labeled with a timestamp (user's local time). If you set a custom name, Liquibase overwrites the existing file every time you generate a new report. Default: report-<DD-Mon-YYYY-HHmmss>.html.

Optional

JAVA_OPTS=-Dliquibase.command.reportPath=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.reportPath=<string>

Specifies the file path to the report file at the command level. Overrides the global argument --reports-path. Default: ./.

Optional

JAVA_OPTS=-Dliquibase.command.schemas=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.schemas=<string>

Schemas to include in diff

Optional

JAVA_OPTS=-Dliquibase.command.username=<string>

JAVA_OPTS=-Dliquibase.command.<cmdName>.username=<string>

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional
Attribute Definition Requirement

LIQUIBASE_COMMAND_REFERENCE_URL=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_URL=<string>

The JDBC reference database connection URL

Required

LIQUIBASE_COMMAND_URL=<string>

LIQUIBASE_COMMAND_<CMDNAME>_URL=<string>

The JDBC database connection URL. See Using JDBC URL in Liquibase.

Required

LIQUIBASE_COMMAND_DEFAULT_CATALOG_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DEFAULT_CATALOG_NAME=<string>

Name of the default catalog to use for the database connection

Optional

LIQUIBASE_COMMAND_DEFAULT_SCHEMA_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DEFAULT_SCHEMA_NAME=<string>

Name of the default schema to use for the database connection. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional

LIQUIBASE_COMMAND_DIFF_TYPES=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DIFF_TYPES=<string>

Specifies the types of objects to compare. Specify multiple values as a comma-separated list (without spaces). Valid values are: catalogs, checkconstraints, columns, data, databasepackage, databasepackagebody, foreignkeys, functions, indexes, primarykeys, sequences, storedprocedures, triggers, uniqueconstraints, views.

If null, default types are columns, foreignkeys, indexes, primarykeys, tables, uniqueconstraints, views.

Note: The diff types checkconstraints, databasepackage, databasepackagebody, functions, storedprocedures, and triggers require a valid Liquibase Pro license key to use.

Optional

LIQUIBASE_COMMAND_DRIFT_SEVERITY=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DRIFT_SEVERITY=<string>

Specifies the severity level of all error types in the drift report (changed, missing, or unexpected content). Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. If both --drift-severity and one of the individual error type arguments are set, the individual error type arguments take priority. Default: INFO.

Optional

LIQUIBASE_COMMAND_DRIFT_SEVERITY_CHANGED=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DRIFT_SEVERITY_CHANGED=<string>

Specifies the severity level of changed content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for changed content only. Default: INFO.

Optional

LIQUIBASE_COMMAND_DRIFT_SEVERITY_MISSING=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DRIFT_SEVERITY_MISSING=<string>

Specifies the severity level of missing content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for missing content only. Default: INFO.

Optional

LIQUIBASE_COMMAND_DRIFT_SEVERITY_UNEXPECTED=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DRIFT_SEVERITY_UNEXPECTED=<string>

Specifies the severity level of unexpected content in the drift report. Valid values are INFO (0), MINOR (1), MAJOR (2), CRITICAL (3), and BLOCKER (4), from least severe to most severe. Overrides the value of --drift-severity for unexpected content only. Default: INFO.

Optional

LIQUIBASE_COMMAND_DRIVER=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DRIVER=<string>

The JDBC driver class

Optional

LIQUIBASE_COMMAND_DRIVER_PROPERTIES_FILE=<string>

LIQUIBASE_COMMAND_<CMDNAME>_DRIVER_PROPERTIES_FILE=<string>

The JDBC driver properties file

Optional

LIQUIBASE_COMMAND_EXCLUDE_OBJECTS=<string>

LIQUIBASE_COMMAND_<CMDNAME>_EXCLUDE_OBJECTS=<string>

Objects to exclude from diff

Optional

LIQUIBASE_COMMAND_FORMAT=<string>

LIQUIBASE_COMMAND_<CMDNAME>_FORMAT=<string>

Option to create JSON output. See diff JSON.

Optional

LIQUIBASE_COMMAND_INCLUDE_OBJECTS=<string>

LIQUIBASE_COMMAND_<CMDNAME>_INCLUDE_OBJECTS=<string>

Objects to include in diff

Optional

LIQUIBASE_COMMAND_OPEN_REPORT=<true|false>

LIQUIBASE_COMMAND_<CMDNAME>_OPEN_REPORT=<true|false>

If true, automatically opens the report in your default browser. Default: false.

Optional

LIQUIBASE_COMMAND_OUTPUT_SCHEMAS=<string>

LIQUIBASE_COMMAND_<CMDNAME>_OUTPUT_SCHEMAS=<string>

Lets you replace the schemas in the output changelog. This is a CSV list. The parameter size must match --schemas. If you have three items names in --schemas, you must also have three items in --output-schemas.

Example: liquibase generate-changelog --schemas=a,b,c --output-schemas=d,e,f

Optional

LIQUIBASE_COMMAND_PASSWORD=<string>

LIQUIBASE_COMMAND_<CMDNAME>_PASSWORD=<string>

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

LIQUIBASE_COMMAND_REFERENCE_DEFAULT_CATALOG_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_DEFAULT_CATALOG_NAME=<string>

The reference default catalog name to use for the database connection

Optional

LIQUIBASE_COMMAND_REFERENCE_DEFAULT_SCHEMA_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_DEFAULT_SCHEMA_NAME=<string>

The reference default schema name to use for the database connection

Optional

LIQUIBASE_COMMAND_REFERENCE_DRIVER=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_DRIVER=<string>

The JDBC driver class for the reference database

Optional

LIQUIBASE_COMMAND_REFERENCE_DRIVER_PROPERTIES_FILE=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_DRIVER_PROPERTIES_FILE=<string>

The JDBC driver properties file for the reference database

Optional

LIQUIBASE_COMMAND_REFERENCE_LIQUIBASE_CATALOG_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_LIQUIBASE_CATALOG_NAME=<string>

Reference database catalog to use for Liquibase objects. Liquibase 4.24.0+.

Optional

LIQUIBASE_COMMAND_REFERENCE_LIQUIBASE_SCHEMA_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_LIQUIBASE_SCHEMA_NAME=<string>

Reference database schema to use for Liquibase objects. Liquibase 4.24.0+.

Optional

LIQUIBASE_COMMAND_REFERENCE_PASSWORD=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_PASSWORD=<string>

The reference database password.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

LIQUIBASE_COMMAND_REFERENCE_SCHEMAS=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_SCHEMAS=<string>

Schemas names on reference database to use in diff. This is a CSV list.

Optional

LIQUIBASE_COMMAND_REFERENCE_USERNAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REFERENCE_USERNAME=<string>

The reference database username.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

LIQUIBASE_COMMAND_REPORT_ENABLED=<true|false>

LIQUIBASE_COMMAND_<CMDNAME>_REPORT_ENABLED=<true|false>

Enables a report at the command level. Overrides the global argument --reports-enabled. Default: false.

Optional

LIQUIBASE_COMMAND_REPORT_NAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REPORT_NAME=<string>

Specifies the name of the report file at the command level. Overrides the global argument --reports-name. By default, Liquibase generates a new report file labeled with a timestamp (user's local time). If you set a custom name, Liquibase overwrites the existing file every time you generate a new report. Default: report-<DD-Mon-YYYY-HHmmss>.html.

Optional

LIQUIBASE_COMMAND_REPORT_PATH=<string>

LIQUIBASE_COMMAND_<CMDNAME>_REPORT_PATH=<string>

Specifies the file path to the report file at the command level. Overrides the global argument --reports-path. Default: ./.

Optional

LIQUIBASE_COMMAND_SCHEMAS=<string>

LIQUIBASE_COMMAND_<CMDNAME>_SCHEMAS=<string>

Schemas to include in diff

Optional

LIQUIBASE_COMMAND_USERNAME=<string>

LIQUIBASE_COMMAND_<CMDNAME>_USERNAME=<string>

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication. Also, you can specify database credentials as part of the url attribute.

Drift report

In Liquibase 4.25.0 and later, you can automatically generate a Drift Report using the diff command. The drift report requires a Liquibase Pro license key.

Related links