unexpected-changesets

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

Uses

The unexpected-changesets 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 unexpected-changesets command will detect those changesets and produce them in your output.

The unexpected-changesets 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 unexpected-changesets 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 unexpected-changesets command.

Running the unexpected-changesets command

To run the unexpected-changesets command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Create and Configure a liquibase.properties File. You can also specify these properties in your command line.

Then run the unexpected-changesets command:

liquibase --changelog-file=changelog.xml unexpected-changesets

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

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

liquibase --changelog-file=changelog.xml unexpected-changesets --verbose

unexpected-changesets global attributes

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

Attribute Definition Requirement
--changelog-file

The root changelog

Required
--url

The JDBC database connection URL

Required
--username

The database username

Required
--password

The database password

Required

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