The unexpectedChangeSets command produces a list of changesets that were run in the database but do not exist in the current changelog.


The unexpectedChangeSets command is typically used to detect and compare the changes between the DATABASECHANGELOG table and the current changelog. If any of the changesets in the DATABASECHANGELOG table do not exist in the current changelog, the unexpectedChangeSets command will detect those changesets and produce them in your output.

The unexpectedChangeSets command also produces all the changesets that were previously deployed and deleted from your current changelog.

The following image shows the changelog file, which includes changesets for release 1 that are already applied to the database but removed from the changelog file and new changesets for release 2 that are not applied to the database. Running the unexpectedChangeSets command will produce the number of changesets applied for release 1.

So, if you want to identifying unexpected changesets that were previously applied to the database, run the unexpectedChangeSets command.

Running the unexpectedChangeSets command

To run the unexpectedChangeSets command, you can specify the driver, classpath, and URL in your liquibase.properties file. For more information, see Creating and configuring a liquibase.properties file. You can also specify these properties in your command line.

Then run the unexpectedChangeSets command:

liquibase --changeLogFile=changelog.xml unexpectedChangeSets

Note: Enter the name of the changelog you want to use in place of changelog.xml. You can also specify the changelog file in your liquibase.properties file. The output will show the number of unexpected changesets.

To see the list of unexpected changesets, add the --verbose flag while running the command:

liquibase --changeLogFile=changelog.xml unexpectedChangeSets --verbose

unexpectedChangeSets global attributes


Definition Requirement


The root changelog



The JDBC database connection URL



The database username



The database password


Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.