changelogSync command

The changelogSync command marks all undeployed changes in your changelog as executed in your database.

Uses

The changelogSync command is typically used when you want to baseline a new database environment.

An example use case for the changelogSync command is when you have a DEV environment with a set of objects used only in DEV, and you want to use the same changelog to manage a new TEST environment.

The TEST environment does not have or need, those DEV-only objects. To avoid deploying the DEV-only objects, you run the changelogSync command to mark those changes as executed in the DATABASECHANGELOG which tells Liquibase to treat these databases as equivalent.

You can also use the changeLogSync command to mark a change as executed if the object associated with the change was created manually on the database. By marking the changeset as executed, it prevents the next Liquibase update from failing as it tries to create an object that already exists.

Running the changelogSync command

To run the changelogSync command, you need to specify your driver, class path, URL, and user authentication information 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 changelogSync command:

liquibase --changelogFile=mychangelog.postgresql.sql changelogSync

Note: Enter the name of the changelog that you want to use in place of mychangelog.postgresql.sql.

changelogSync global attributes

Attributes Definition Requirements
--changeLogFile The root changelog Required
--url The JDBC database connection URL Required
--username The database username Required
--password The database password Required

Output

When successful, the changelogSync command produces the following output:
Liquibase Pro 3.8.7 by Datical licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020
postgres@jdbc:postgresql://localhost:5432/MYDATABASE2 is up to date
Liquibase command 'status' was executed successfully.