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

Procedure

1

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.

2

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.

3

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
4

Manually change the local development database if needed.

5

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.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 by running the changelog-sync command.

liquibase changelog-sync
8

Commit the changes to the source control.