Track and append manual changes with snapshots and diff-changelog
Last updated: July 14, 2025
Even when using changelogs to manage database changes, manual updates can still happen—especially in development. Liquibase allows you to capture these changes by taking a snapshot of your local environment and comparing it to a reference database. This lets you safely review and append new changes to your changelog.
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
Get the latest changelog from source control.
Make sure your local changelog is up to date and includes the most recent changes from your team.
Verify your local database is current.
Configure your liquibase.properties
file to point to your local development database and run:
liquibase update
This ensures your database matches the current changelog before introducing any new changes.
Take a snapshot of your development database.
The example code will generate the snapshot in json format. Be sure to change the format and extension if you would like to output the snapshot in a different format.
liquibase --output-file=myschemaSnapshot.json snapshot --snapshot-format=json
Manually change the local development database if needed.
Append changes to the changelog.
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.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>
.
Review the changelog file to ensure that it matches your expectations of the manual changes that were made.
Mark the manual changes as deployed in the local development database by running the changelog-sync command.
liquibase changelog-sync