Compare a single database's current state against a previous state

Last updated: September 2, 2025

If the database is accessible outside of the Liquibase process either via a hotfix pipeline or DBAs/developers have access to the database, it is possible for the Liquibase project to become out of sync with the target database. This option can also determine if code has been deployed to the database outside of the Liquibase process.

Procedure

Variable descriptions for the example commands:

$targetURL: This is the normal JDBC URL used to connect to the database.

<db_type>: This value needs to be set to the type of database (Postgres, Oracle, etc.).

This value is referred to as the DBMS or "shortname," which can be found for all supported databases.

<snapshot_file_name>: the snapshot file containing the current state of the database in a JSON format.

<changelog_file_name>: the generated changelog (set to SQL) containing changesets that are not in the database.

1

Run the update command on the target database.

liquibase --url=$targetURL update

2

Run the snapshot command to capture the current state of the database.

liquibase --url=$targetURL update

3

Run a diff-changelog to compare the snapshot to the target database.

liquibase --url=$targetURL update

Compare a single database's current state against a previous state - Liquibase