calculate-checksum

The calculate-checksum command calculates and prints a checksum for a changeset in your changelog.

Uses

The calculate-checksum command is typically used to compute an MD5 checksum, which serves as a unique identifier for the changeset. As a result, you can see whether the changeset has been changed and whether it has to be deployed differently now.

The MD5SUM column in the DATABASECHANGELOG table contains a checksum of the changeset and any change made in the changeset will result in a different checksum.

For more information, see Changeset Checksums.

Syntax

To run the calculate-checksum command, specify the driver, classpath, and URL in the Liquibase properties file or in your command line. For more information, see Create and Configure a liquibase.properties File.

When you run calculate-checksum, you must identify which changeset to target by specifying its filepath, ID, and author in the following format: filepath::id::author. The filepath refers to the path from the current working directory to the changelog that your changeset is in. For example:

liquibase calculate-checksum --changeset-identifier=com/example/example-changelog.xml::1::adrian

If you want to run this command on a changeset that uses the logicalFilePath attribute, specify the logical filepath instead.

Note: In Liquibase 4.25.0 and later, you can instead specify the changeset identifier with the individual attributes --changeset-author, --changeset-id, and --changeset-path.

Note: The --changeset-identifier=value syntax was added in Liquibase 4.4. If you use an older version, specify your identifier as a positional argument: <command> value.

Command parameters

Attribute Definition Requirement

--changelog-file=<string>

The root changelog

Required

--url=<string>

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

Required

--changeset-author=<string>

Author of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

--changeset-id=<string>

ID of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

--changeset-identifier=<string>

Tag defined as a number or a descriptive name that is unique to each changeset. Requires the following format: filepath::id::author. Specify as --changeset-identifier=value. Positional format <command> <value> deprecated in 4.4+.

In 4.25.0+, you can either specify --changeset-identifier in the filepath::id::author format or specify --changeset-author, --changeset-id, and --changeset-path individually. However, you cannot specify a changeset in both ways.

Optional

--changeset-path=<string>

Path of the changelog that contains the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

--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

--driver=<string>

The JDBC driver class

Optional

--driver-properties-file=<string>

The JDBC driver properties file

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

--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: { changelog-file: "<string>" }

The root changelog

Required

cmdArgs: { url: "<string>" }

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

Required

cmdArgs: { changeset-author: "<string>" }

Author of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

cmdArgs: { changeset-id: "<string>" }

ID of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

cmdArgs: { changeset-identifier: "<string>" }

Tag defined as a number or a descriptive name that is unique to each changeset. Requires the following format: filepath::id::author. Specify as --changeset-identifier=value. Positional format <command> <value> deprecated in 4.4+.

In 4.25.0+, you can either specify --changeset-identifier in the filepath::id::author format or specify --changeset-author, --changeset-id, and --changeset-path individually. However, you cannot specify a changeset in both ways.

Optional

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

Path of the changelog that contains the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

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: { driver: "<string>" }

The JDBC driver class

Optional

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

The JDBC driver properties file

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: { 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.changelogFile: <string>

liquibase.command.calculateChecksum.changelogFile: <string>

The root changelog

Required

liquibase.command.url: <string>

liquibase.command.calculateChecksum.url: <string>

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

Required

liquibase.command.changesetAuthor: <string>

liquibase.command.calculateChecksum.changesetAuthor: <string>

Author of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

liquibase.command.changesetId: <string>

liquibase.command.calculateChecksum.changesetId: <string>

ID of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

liquibase.command.changesetIdentifier: <string>

liquibase.command.calculateChecksum.changesetIdentifier: <string>

Tag defined as a number or a descriptive name that is unique to each changeset. Requires the following format: filepath::id::author. Specify as --changeset-identifier=value. Positional format <command> <value> deprecated in 4.4+.

In 4.25.0+, you can either specify --changeset-identifier in the filepath::id::author format or specify --changeset-author, --changeset-id, and --changeset-path individually. However, you cannot specify a changeset in both ways.

Optional

liquibase.command.changesetPath: <string>

liquibase.command.calculateChecksum.changesetPath: <string>

Path of the changelog that contains the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

liquibase.command.defaultCatalogName: <string>

liquibase.command.calculateChecksum.defaultCatalogName: <string>

Name of the default catalog to use for the database connection

Optional

liquibase.command.defaultSchemaName: <string>

liquibase.command.calculateChecksum.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.driver: <string>

liquibase.command.calculateChecksum.driver: <string>

The JDBC driver class

Optional

liquibase.command.driverPropertiesFile: <string>

liquibase.command.calculateChecksum.driverPropertiesFile: <string>

The JDBC driver properties file

Optional

liquibase.command.password: <string>

liquibase.command.calculateChecksum.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.username: <string>

liquibase.command.calculateChecksum.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.changelogFile=<string>

JAVA_OPTS=-Dliquibase.command.calculateChecksum.changelogFile=<string>

The root changelog

Required

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

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

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

Required

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

JAVA_OPTS=-Dliquibase.command.calculateChecksum.changesetAuthor=<string>

Author of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

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

JAVA_OPTS=-Dliquibase.command.calculateChecksum.changesetId=<string>

ID of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

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

JAVA_OPTS=-Dliquibase.command.calculateChecksum.changesetIdentifier=<string>

Tag defined as a number or a descriptive name that is unique to each changeset. Requires the following format: filepath::id::author. Specify as --changeset-identifier=value. Positional format <command> <value> deprecated in 4.4+.

In 4.25.0+, you can either specify --changeset-identifier in the filepath::id::author format or specify --changeset-author, --changeset-id, and --changeset-path individually. However, you cannot specify a changeset in both ways.

Optional

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

JAVA_OPTS=-Dliquibase.command.calculateChecksum.changesetPath=<string>

Path of the changelog that contains the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

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

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

Name of the default catalog to use for the database connection

Optional

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

JAVA_OPTS=-Dliquibase.command.calculateChecksum.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.driver=<string>

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

The JDBC driver class

Optional

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

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

The JDBC driver properties file

Optional

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

JAVA_OPTS=-Dliquibase.command.calculateChecksum.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.username=<string>

JAVA_OPTS=-Dliquibase.command.calculateChecksum.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_CHANGELOG_FILE=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_CHANGELOG_FILE=<string>

The root changelog

Required

LIQUIBASE_COMMAND_URL=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_URL=<string>

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

Required

LIQUIBASE_COMMAND_CHANGESET_AUTHOR=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_CHANGESET_AUTHOR=<string>

Author of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

LIQUIBASE_COMMAND_CHANGESET_ID=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_CHANGESET_ID=<string>

ID of the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

LIQUIBASE_COMMAND_CHANGESET_IDENTIFIER=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_CHANGESET_IDENTIFIER=<string>

Tag defined as a number or a descriptive name that is unique to each changeset. Requires the following format: filepath::id::author. Specify as --changeset-identifier=value. Positional format <command> <value> deprecated in 4.4+.

In 4.25.0+, you can either specify --changeset-identifier in the filepath::id::author format or specify --changeset-author, --changeset-id, and --changeset-path individually. However, you cannot specify a changeset in both ways.

Optional

LIQUIBASE_COMMAND_CHANGESET_PATH=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_CHANGESET_PATH=<string>

Path of the changelog that contains the changeset. Available in Liquibase 4.25.0+. Cannot be used with --changeset-identifier.

Optional

LIQUIBASE_COMMAND_DEFAULT_CATALOG_NAME=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_DEFAULT_CATALOG_NAME=<string>

Name of the default catalog to use for the database connection

Optional

LIQUIBASE_COMMAND_DEFAULT_SCHEMA_NAME=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_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_DRIVER=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_DRIVER=<string>

The JDBC driver class

Optional

LIQUIBASE_COMMAND_DRIVER_PROPERTIES_FILE=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_DRIVER_PROPERTIES_FILE=<string>

The JDBC driver properties file

Optional

LIQUIBASE_COMMAND_PASSWORD=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_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_USERNAME=<string>

LIQUIBASE_COMMAND_CALCULATE_CHECKSUM_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.

Output

8:42b8af7ffb26b44a2716b330d78b90d5
Liquibase command 'calculate-checksum' was executed successfully.

Related links