Liquibase® version 3.8.1 is now available! Get it for free.
2018 XML Announcement
News Liquibase 3.8.1 Released
06 Nov 2019

- and/or -

All Previous Posts >>

Change: ‘dropPrimaryKey’

Drops an existing primary key

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogall
constraintNameName of the primary keyinformix, firebird, sybaseall
dropIndexall
schemaNameName of the schemaall
tableNameName of the table to drop the primary key ofallall
<changeSet author="liquibase-docs"
        id="dropPrimaryKey-example"
        objectQuotingStrategy="LEGACY">
    <dropPrimaryKey catalogName="cat"
            constraintName="const_name"
            dropIndex="true"
            schemaName="public"
            tableName="person"/>
</changeSet>
changeSet:
  id: dropPrimaryKey-example
  author: liquibase-docs
  objectQuotingStrategy: LEGACY
  changes:
  - dropPrimaryKey:
      catalogName: cat
      constraintName: const_name
      dropIndex: true
      schemaName: public
      tableName: person
{
  "changeSet": {
    "id": "dropPrimaryKey-example",
    "author": "liquibase-docs",
    "objectQuotingStrategy": "LEGACY",
    "changes": [
      {
        "dropPrimaryKey": {
          "catalogName": "cat",
          "constraintName": "const_name",
          "dropIndex": true,
          "schemaName": "public",
          "tableName": "person"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

ALTER TABLE cat.person DROP PRIMARY KEY;

Database Support

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