changelogSyncToTag
command
The changelogSyncToTag
command marks all undeployed changesets from your changelog up to the specified tag as executed in your database. The command also marks the changeset with that tag as deployed.
Note: If you don’t have any tag specified in your changelog file, add it by using the tagDatabase Change Type as follows:
<changeSet id="13.1" author="liquibase">
<tagDatabase tag="version_2.0"/>
</changeSet>
Uses
The changelogSyncToTag
command is typically used when you want to baseline a new database environment with specific objects. An example use case for the changelogSyncToTag
command is the following:
- 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 those DEV-only objects and needs only some of them.
- To deploy the needed DEV-only objects and avoid deploying the rest, you add a tag and run the
changelogSyncToTag
command to mark the changes related to that tag as executed in the DATABASECHANGELOG table. - The command marks all changesets starting with the first changeset at the top of the DEV changelog file and moving down to the changesets up to and including the tag.
- Next, you deploy the changesets that were not marked as deployed in your database. Liquibase treats your DEV and TEST databases as equivalent.
Note: If you want to mark all undeployed changes from the changelog file as executed in your database, use the changelogSync command.
You can also use the changelogSyncToTag
command to mark the change associated with a specific tag 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 changelogSyncToTag
command
Before running the changelogSyncToTag
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.
Next, run the changelogSyncToTag
command:
liquibase --changelogFile=mychangelog.xml changelogSyncToTag version1
Note: Enter the name of the changelog and the tag that you want to use in place of mychangelog.xml
and version1
.
changelogSyncToTag
global attributes
Attribute | Definition | Requirements |
---|---|---|
--changeLogFile
|
The root changelog | Required |
--url
|
The JDBC database connection URL | Required |
--username
|
The database username | Required |
--password
|
The database password | Required |
changelogSyncToTag
command attributes
Attribute | Definition | Requirements |
---|---|---|
tag
|
The tag you can add to changesets to determine which changesets in the changelog to evaluate based on their tags. | Required |

Liquibase Pro 4.3.2 by Datical licensed to support until Wed Sep 22 23:59:59 CDT 2021
####################################################
## _ _ _ _ ##
## | | (_) (_) | ##
## | | _ __ _ _ _ _| |__ __ _ ___ ___ ##
## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ##
## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ##
## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ##
## | | ##
## |_| ##
## ##
## Get documentation at docs.liquibase.com ##
## Get certified courses at learn.liquibase.com ##
## Free schema change activity reports at ##
## https://hub.liquibase.com ##
## ##
####################################################
Starting Liquibase at 11:08:28 (version 4.3.2 #44 built at 2021-03-23 14:01+0000)
Liquibase command 'changelogSyncToTag' was executed successfully.