tagDatabase
The tagDatabase Change Type applies a tag to the database for future update or rollback.
Tip: If you want to apply a tag to your database without modifying your changelog, use the tag command. To check whether a tag exists, use the tag-exists command.
Uses
You can typically use the tagDatabase Change Type when you want to tag your current database state, release, or version, and then deploy new changesets to that tag or roll back changesets applied after that tag. If you deploy a tagDatabase changeset from your changelog, it adds a new row to the DATABASECHANGELOG table. This row will have the tag name specified in that changeset.
When you run the update-to-tag command or the Maven update goal with the liquibase.toTag attribute, and there is a row in the DATABASECHANGELOG table corresponding to the tagDatabase changeset in the changelog, the update-to-tag command or the update Maven goal deploys all changesets starting with the first changeset at the top of the changelog file and moving down to the changeset up to the tag specified by the tagDatabase Change Type.
When you want to roll back changesets deployed after the tagDatabase Change Type, the rollback command, or the Maven rollback goal with the liquibase.rollbackTag attribute will remove your changesets and the tagDatabase row specified with the rollback command or goal.
Note: The XSD doesn't allow the tagDatabase Change Type to be used with another Change Types in the same changeset.
Running the tagDatabase Change Type
To run this Change Type, follow these steps:
Add the Change Type to your changeset, as shown in the examples on this page.
Specify any required attributes. Use the table on this page to see which ones your database requires.
Deploy your changeset by running the
updatecommand:liquibase update
Now, you should see that the tag has been applied to the DATABASECHANGELOG table as a new changeset row.
Available attributes
Name | Description | Required for |
| When enabled (set to true), this attribute retains the DBCL row containing the tag defined in the tagDatabase Changeset during a rollback. By default, it is disabled (set to 'false'). | Optional |
| The tag to apply | all |
Database support
Database | Notes | |
DB2/LUW | Supported | Yes |
DB2/z | Supported | Yes |
Derby | Supported | Yes |
Firebird | Supported | Yes |
Google BigQuery | Supported | Yes |
H2 | Supported | Yes |
HyperSQL | Supported | Yes |
INGRES | Supported | Yes |
Informix | Supported | Yes |
MariaDB | Supported | Yes |
MySQL | Supported | Yes |
Oracle | Supported | Yes |
PostgreSQL | Supported | Yes |
Snowflake | Supported | Yes |
SQL Server | Supported | Yes |
SQLite | Supported | Yes |
Sybase | Supported | Yes |
Sybase Anywhere | Supported | Yes |
tagDatabase examples
* tagDatabase IS supported IN formatted SQL changelogs IN Liquibase Pro 4.29 .2
AND later.*
--liquibase formatted sql
--changeset liquibase-docs:tagDatabase-example
--tagDatabase: 'version_1.3'