Liquibase® version 3.8.5 is now available! Get it for free.
2018 XML Announcement
News All Previous Posts >>

Subscribe for email updates

- and/or -

Change: ‘dropPrimaryKey’

Drops an existing primary key

Available Attributes

NameDescription
catalogNameName of the catalogE.g. 'cat'
constraintNameName of the primary keyE.g. 'const_name'Required for: firebird, informix, sybase
dropIndexboolean
schemaNameName of the schemaE.g. 'public'
tableNameName of the table to drop the primary key ofE.g. 'person'
<changeSet author="liquibase-docs" id="dropPrimaryKey-example">
    <dropPrimaryKey catalogName="cat"
            constraintName="const_name"
            dropIndex="true"
            schemaName="public"
            tableName="person"/>
</changeSet>
changeSet:
  id: dropPrimaryKey-example
  author: liquibase-docs
  changes:
  - dropPrimaryKey:
      catalogName: cat
      constraintName: const_name
      dropIndex: true
      schemaName: public
      tableName: person
{
  "changeSet": {
    "id": "dropPrimaryKey-example",
    "author": "liquibase-docs",
    "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
DB2/LUWSupportedNo
DB2/zSupportedNo
DerbySupportedNo
FirebirdSupportedNo
H2SupportedNo
HyperSQLSupportedNo
INGRESSupportedNo
InformixSupportedNo
MariaDBSupportedNo
MySQLSupportedNo
OracleSupportedNo
PostgreSQLSupportedNo
SQL ServerSupportedNo
SQLiteSupportedNo
SybaseSupportedNo
Sybase AnywhereSupportedNo