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
Make sure you've installed Liquibase and can run
liquibase
from your command line.Connect your database to Liquibase. You'll need to follow the integration guide for your specific database.
If you have an existing database, you'll also need to generate your changelog from your existing database.
Set up your changelog structure and be sure your changelogs are connected.
Procedure
Make sure your local environment is up-to-date by getting the latest changelog from source control.
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.
Take a snapshot of the local development database by running the snapshot-reference command.
Manually change the local development database if needed.
Append changes to the changelog by running the diff-changelog command.
Note: If you want to see changes without appending them to the changelog file, add--changelog-file=mydiffchangelog.xml
to thediff-changelog
command:
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>
.