Change: ‘dropForeignKeyConstraint’

Drops an existing foreign key

Available Attributes

NameDescriptionRequired ForSupportsSince
baseTableCatalogNameall3.0
baseTableNameName of the table containing the column constrained by the foreign keyinformix, sybase, unsupported, asany, postgresql, firebird, oracle, mssql, hsqldb, db2, mysql, h2, derbyall
baseTableSchemaNameall
constraintNameName of the foreign key constraint to dropinformix, sybase, unsupported, asany, postgresql, firebird, oracle, mssql, hsqldb, db2, mysql, h2, derbyall
<changeSet author="liquibase-docs" id="dropForeignKeyConstraint-example">
    <dropForeignKeyConstraint baseTableName="person" constraintName="fk_address_person"/>
</changeSet>
changeSet:
  id: dropForeignKeyConstraint-example
  author: liquibase-docs
  changes:
  - dropForeignKeyConstraint:
      baseTableName: person
      constraintName: fk_address_person
{
  "changeSet": {
    "id": "dropForeignKeyConstraint-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "dropForeignKeyConstraint": {
          "baseTableName": "person",
          "constraintName": "fk_address_person"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

ALTER TABLE person DROP FOREIGN KEY fk_address_person;

Database Support

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

Missing, incomplete or wrong information? Please send a pull request