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: ‘dropColumn’

Drop existing column(s).

To drop a single column, use the simple form of this element where the tableName and columnName are specified as attributes. To drop several columns, specify the tableName as an attribute, and then specify a set of nested <column> tags. If nested <column> tags are present, the columnName attribute will be ignored.

Available Attributes

NameDescription
catalogNameName of the catalog@ v3.0E.g. 'cat'
columnNameName of the column to drop, if dropping a single column. Ignored if nested 'column's are definedE.g. 'id'
schemaNameName of the schemaE.g. 'public'
tableNameName of the table containing the column(s) to dropE.g. 'person'

Nested Properties

NameDescription
columns / column [0..N]Columns to be dropped if dropping multiple columns. If this is populated, the columnName attribute is ignored.Note: columns tag not required in XML
Attributes
name Name of the column shall be dropped.
<changeSet author="liquibase-docs" id="dropColumn-example">
    <dropColumn catalogName="cat"
            columnName="id"
            schemaName="public"
            tableName="person">
        <column name="address"/>
    </dropColumn>
</changeSet>
changeSet:
  id: dropColumn-example
  author: liquibase-docs
  changes:
  - dropColumn:
      catalogName: cat
      columnName: id
      columns:
      - column:
          name: address
      schemaName: public
      tableName: person
{
  "changeSet": {
    "id": "dropColumn-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "dropColumn": {
          "catalogName": "cat",
          "columnName": "id",
          "columns": [
            {
              "column": {
                "name": "address"
              }
            }]
          ,
          "schemaName": "public",
          "tableName": "person"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

ALTER TABLE cat.person DROP COLUMN address;

Database Support

DatabaseNotesAuto Rollback
DB2/LUWSupportedNo
DB2/zNot SupportedNo
DerbySupportedNo
FirebirdSupportedNo
H2SupportedNo
HyperSQLSupportedNo
INGRESSupportedNo
InformixSupportedNo
MariaDBSupportedNo
MySQLSupportedNo
OracleSupportedNo
PostgreSQLSupportedNo
SQL ServerSupportedNo
SQLiteSupportedNo
SybaseSupportedNo
Sybase AnywhereSupportedNo