The diffChangeLog command allows you to receive information on differences between two databases you are comparing and creates a changelog file containing deployable changesets.

The diffChangeLog command points out the differences in general and generates changes to resolve most of them.


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

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

Running the diffChangeLog command

Running the diffChangeLog command requires two URLs:

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

To create a diff changelog:

  • The first option is to run the diffChangeLog command and pass the attributes needed for your source (reference) database and target database.
  • As an example, you can run the following:

    --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: If you want to create an SQL changelog file, add your database type name when specifying the changelog file: liquibase --changeLogFile=mychangelog.oracle.sql diffChangeLog. Replace .oracle.sql with your database type. When in doubt about your database type name, check Supported Databases.

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

    Note: It is best practice to put your driver .jar file in the LIQUIBASE_HOME/lib directory. If you put the driver file in any other directory, specify the path to it in the liquibase.properties file: classpath:../path_to_drivers/ojdbc<version>.jar. For more information, see Creating and configuring a liquibase.properties file. When running the command against two different databases, both drivers should be in the LIQUIBASE_HOME/lib directory. Otherwise, the classpath property should reference both .jar files. Use the path separator that is correct for your operating system (a semicolon on Windows, a colon on Mac or Linux).

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

  • Alternatively, configure the liquibase.properties file to include your connection information for both databases. Run the following command:
  • liquibase --changeLogFile=file_name.xml diffChangeLog

    Note: Replace file_name.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 on how to configure your liquibase.properties file, see the Creating and configuring a liquibase.properties file topic.


The diffChangeLog command produces a list of all Objects and creates a changelog with a list of changesets.

Liquibase Community diffChangeLog categories:

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

Filtering diffChangeLog types

You can filter what objects diffChangeLog generates with the diffTypes attribute:


You can also filter specific objects by name with the includeObjects attribute. For example:


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

Additional Functionality with Liquibase Pro

While Liquibase Community 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
  • function
  • trigger
  • synonyms

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

The diffChangeLog command structures stored logic files into timestamped directories every time you run the command.

Note: Liquibase does not currently check data type length.