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 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
Attribute |
Definition | Requirement |
---|---|---|
|
The root changelog |
Required |
|
The JDBC database connection URL |
Required |
|
The database username |
Required |
|
The database password |
Required |

When running the unexpectedChangeSets
command with the --verbose
flag, the output can be as follows:
Liquibase Pro 3.9.0 by Datical licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020
20 unexpected changes were found in HR_DEV@jdbc:oracle:thin:@support.datical.net:1521:ORCL
../changelog.oracle.sql::1585673761195-1::support.liquibase.net
../changelog.oracle.sql::1585673761195-2::support.liquibase.net
../changelog.oracle.sql::1585673761195-3::support.liquibase.net
../changelog.oracle.sql::1585673761195-4::support.liquibase.net
../changelog.oracle.sql::1585673761195-5::support.liquibase.net
../changelog.oracle.sql::1585673761195-6::support.liquibase.net
../changelog.oracle.sql::1585673761195-8::support.liquibase.net
../changelog.oracle.sql::1585673761195-9::support.liquibase.net
changelog.oracle.sql::158768::SteveZ
changelog.oracle.sql::1587uye::SteveZ
changelog.xml::63f54::SteveZ
changelog.xml::63f434::SteveZ
changelog.xml::63634::SteveZ
changelog.oracle.sql::createTable113::Jack
changelog.oracle.sql::createProc_add_job_history112::Joe
changelog.oracle.sql::createView_EMP_DETAILS_VIEW112::John
changeLogWithRunAlways.xml::159120::SteveZ
samplefile.sql::raw::includeAll
samplefile.sql::1588246573379-865::rajeshmishra
samplefile.sql::1::your.name
Liquibase command 'unexpectedChangeSets' was executed successfully.
When running the unexpectedChangeSets
command without indicating the --verbose
flag, you receive the following output:
Liquibase Pro 3.9.0 by Datical licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020
20 unexpected changes were found in HR_DEV@jdbc:oracle:thin:@support.datical.net:1521:ORCL
Liquibase command 'unexpectedChangeSets' was executed successfully.