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.

When running the calculate-checksum command, the DATABASECHANGELOG table calculates an MD5 checksum for each entry based on the SQL script of the changeset. This checksum helps Liquibase detect differences between the changesets you want to deploy and the changesets that have already been run against the database.

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.

Running the calculate-checksum command

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 com/example/changelog.xml::1::adrian
liquibase calculate-checksum path/to/changelog.oracle.sql::myID_123::Steve

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

calculate-checksum global attributes

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.

Attribute Definition Requirement
--changelog-file

The root changelog

Required
--url

The JDBC database connection URL

Required
--username*

The database username

Required*
--password*

The database password

Required*

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.

calculate-checksum command attributes

Attribute Definition Requirement
<id>

Tag defined as a number or a descriptive name that is unique to each changeset. Requires the following format for the calculate-checksum command: filepath::id::author.

Required

calculate-checksum example output

Liquibase Pro 3.9.0 by Liquibase Enterprise licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020
8:42b8af7ffb26b44a2716b330d78b90d5
Liquibase command 'calculate-checksum' was executed successfully.

Related links