Change: ‘addColumn’

Adds a new column to an existing table

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogall3.0
schemaNameName of the schemaall
tableNameName of the table to add the column toallall

Nested Properties

NameDescriptionRequired ForSupportsMultiple AllowedSince
columnsColumn constraint and foreign key information. Setting the "defaultValue" attribute will specify a default value for the column. Setting the "value" attribute will set all rows existing to the specified value without modifying the column default.

See the column tag documentation for more information
allallyes
<changeSet author="liquibase-docs" id="addColumn-example">
    <addColumn catalogName="cat"
            schemaName="public"
            tableName="person">
        <column name="address" type="varchar(255)"/>
    </addColumn>
</changeSet>
changeSet:
  id: addColumn-example
  author: liquibase-docs
  changes:
  - addColumn:
      catalogName: cat
      columns:
      - column:
          name: address
          type: varchar(255)
      schemaName: public
      tableName: person
{
  "changeSet": {
    "id": "addColumn-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "addColumn": {
          "catalogName": "cat",
          "columns": [
            {
              "column": {
                "name": "address",
                "type": "varchar(255)"
              }
            }]
          ,
          "schemaName": "public",
          "tableName": "person"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

ALTER TABLE cat.person ADD address VARCHAR(255) NULL;

Database Support

DatabaseNotesAuto Rollback
DB2SupportedYes
DerbySupportedYes
FirebirdSupportedYes
H2SupportedYes
HyperSQLSupportedYes
InformixSupportedYes
MySQLSupportedYes
OracleSupportedYes
PostgreSQLSupportedYes
SQL ServerSupportedYes
SQLiteSupportedYes
SybaseSupportedYes
Sybase AnywhereSupportedYes

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