Liquibase® version 3.8.2 is now available! Get it for free.
2018 XML Announcement
News 5 Ways to Fix a Bad Database Change in Liquibase
04 Dec 2019

- and/or -

All Previous Posts >>

Change: ‘dropUniqueConstraint’

Drops an existing unique constraint

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogall3.0
constraintNameName of unique constraint to dropallall
schemaNameName of the schemaall
tableNameName of the table to drop the unique constraint fromallall
uniqueColumnsall
<changeSet author="liquibase-docs"
        id="dropUniqueConstraint-example"
        objectQuotingStrategy="LEGACY">
    <dropUniqueConstraint catalogName="cat"
            constraintName="const_name"
            schemaName="public"
            tableName="person"
            uniqueColumns="name"/>
</changeSet>
changeSet:
  id: dropUniqueConstraint-example
  author: liquibase-docs
  objectQuotingStrategy: LEGACY
  changes:
  - dropUniqueConstraint:
      catalogName: cat
      constraintName: const_name
      schemaName: public
      tableName: person
      uniqueColumns: name
{
  "changeSet": {
    "id": "dropUniqueConstraint-example",
    "author": "liquibase-docs",
    "objectQuotingStrategy": "LEGACY",
    "changes": [
      {
        "dropUniqueConstraint": {
          "catalogName": "cat",
          "constraintName": "const_name",
          "schemaName": "public",
          "tableName": "person",
          "uniqueColumns": "name"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

ALTER TABLE cat.person DROP KEY const_name;

Database Support

DatabaseNotesAuto Rollback
DB2SupportedNo
DB2SupportedNo
DerbySupportedNo
FirebirdSupportedNo
H2SupportedNo
HyperSQLSupportedNo
INGRESSupportedNo
InformixSupportedNo
MariaDBSupportedNo
MySQLSupportedNo
OracleSupportedNo
PostgreSQLSupportedNo
SQL ServerSupportedNo
SQLiteNot SupportedNo
SybaseSupportedNo
Sybase AnywhereSupportedNo