The diff-changelog command displays the differences between two databases you are comparing. It also generates a changelog file containing deployable changesets to resolve most of these differences.


The diff-changelog command is typically used when you want to create a deployable changelog to synchronize multiple databases. The diff-changelog command also provides more information about:

  • Missing objects in your database
  • Changes made to your database
  • Unexpected items in your database

Running the diff-changelog command

Running the diff-changelog  command requires two URLs:

  • referenceURL – the source for the comparison. The referenceUrl attribute represents your source (reference) database, which is the basis for the database you want to compare.
  • url – the target of the comparison. The url attribute represents your target database, which you want to compare to the source (reference) database. You typically perform actions and run commands on this database.

To create a diff changelog:

  • Option 1: Run the diff-changelog command with all necessary attributes in the CLI:
  • liquibase
    --url="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
    --referenceUrl="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"

    Tip: For best results, specify all commands and parameters with the --kebab-case format in the CLI. If your preference is camelCase, it will still work in the CLI.

    See the snapshot command topic for an example of using a snapshot file as one of the databases being used in the command.

    Tip: Liquibase recommends that you place your database's JDBC driver JAR file in the liquibase/lib directory. If you place the driver file in a different directory, specify the path in the properties file: classpath:../<path-to-drivers>/ojdbc<version>.jar. For more information, see Specifying Properties in a Connection Profile. When you run the diff command against two databases, either the drivers for both must be in the liquibase/lib directory or the classpath property must reference both JAR files. Use the appropriate path separator for your operating system: for Windows, use a semicolon; for Mac or Linux, use a colon.

    Example: classpath: ojdbc7.jar:postgresql-42.2.8.jar

  • Option 2: Configure the Liquibase properties file to include the connection information for both databases. Then, run the following command in the CLI:
  • liquibase --changelog-file=dbchangelog.xml diff-changelog 

    Note: Replace dbchangelog.xml with your filename and extension format. If you specify a file name that already exists, Liquibase will append your changes to the existing file.

    For information about configuring the Liquibase properties file, see Specifying Properties in a Connection Profile.


The diff-changelog command produces a list of all objects and creates a changelog with a list of changesets.

Liquibase Open Source diff-changelog categories:

  • Catalog
  • Column
  • Foreign Key
  • Index
  • Primary Key
  • Schema
  • Sequence
  • Unique Constraints
  • View

Filtering diff-changelog types

You can filter what objects diff-changelog generates with the diffTypes attribute:


You can also filter specific objects by name with the includeObjects and excludeObjects attributes. For example:


This way, you can prevent any undesired objects from ending up in the resulting changelog.

Additional Functionality with Liquibase Pro

While Liquibase Open Source stores all changesets in a changelog, Liquibase Pro creates a directory called Objects and places the directory at the same level as your changelog. The Objects directory contains a subdirectory for each of the following stored logic types:

  • checkconstraint
  • package
  • packagebody
  • procedure
  • function
  • trigger
  • synonyms

Note: Not all database platforms support all stored logic types that are listed.

The diff-changelog command structures stored logic files into timestamped directories every time you run the command.

Note: Liquibase does not currently check data type length.