Using snapshot-reference in diff-changelog commands

Last updated: July 14, 2025

You can use the JSON format snapshot file in the diff and diff-changelog commands.

Before you begin

Procedure

1

Make sure your local environment is up-to-date by getting the latest changelog from source control.

2

Configure the Liquibase properties file to point to a local development database and run the update command to ensure your source database matches the changelog file.

3

Take a snapshot of the local development database by running the snapshot-reference command.

liquibase --output-file=myschemaSnapshot.json snapshot-reference --snapshot-format=json
4

Manually change the local development database if needed.

5

Append changes to the changelog by running the diff-changelog command.

liquibase diff-changelog --reference-url=jdbc:oracle:thin://localhost:9090/mem:test --url="offline:oracle?snapshot=mySnapshot.json"

Note: If you want to see changes without appending them to the changelog file, add--changelog-file=mydiffchangelog.xmlto thediff-changelogcommand:

liquibase diff-changelog --reference-url=jdbc:oracle:thin://localhost:9090/mem:test --url="offline:oracle?snapshot=mySnapshot.json" --changelog-file=mydiffchangelog.xml

Note: The format for the URL is the following:"offline:<dbms shortname>?snapshot=<path/to/snapshot.json>"(with quotes). Use the name of your database type from the list of the Liquibase Database Tutorials in place of <dbms shortname> and the path relative to where the command is running in place of<path/to/snapshot.json>.

6

Review the changelog file to ensure that it matches your expectations of the manual changes that were made.

7

Mark the manual changes as deployed in the local development database.

liquibase changelog-sync
Using snapshot-reference in diff-changelog commands - Liquibase