unexpectedChangeSets command

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

Uses

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 deleted changesets that were previously deployed from the 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 need to specify your driver, class path, 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

Attribute

Definition Requirement

--changeLogFile

The root changelog

Required

--url

The JDBC database connection URL

Required

--username

The database username

Required

--password

The database password

Required