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

Makes a column nullable

Available Attributes

NameDescription
catalogNameName of the catalog@ v3.0E.g. 'cat'
columnDataTypeCurrent data type of the columnE.g. 'int'Required for: informix, mariadb, mssql, mysql
columnNameName of the column to drop the constraint fromE.g. 'id'
schemaNameName of the schemaE.g. 'public'
tableNameName of the table containing that the column to drop the constraint fromE.g. 'person'
<changeSet author="liquibase-docs" id="dropNotNullConstraint-example">
    <dropNotNullConstraint catalogName="cat"
            columnDataType="int"
            columnName="id"
            schemaName="public"
            tableName="person"/>
</changeSet>
changeSet:
  id: dropNotNullConstraint-example
  author: liquibase-docs
  changes:
  - dropNotNullConstraint:
      catalogName: cat
      columnDataType: int
      columnName: id
      schemaName: public
      tableName: person
{
  "changeSet": {
    "id": "dropNotNullConstraint-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "dropNotNullConstraint": {
          "catalogName": "cat",
          "columnDataType": "int",
          "columnName": "id",
          "schemaName": "public",
          "tableName": "person"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

ALTER TABLE cat.person MODIFY id INT NULL;

Database Support

DatabaseNotesAuto Rollback
DB2/LUWSupportedYes
DB2/zNot SupportedYes
DerbySupportedYes
FirebirdNot SupportedYes
H2SupportedYes
HyperSQLSupportedYes
INGRESSupportedYes
InformixSupportedYes
MariaDBSupportedYes
MySQLSupportedYes
OracleSupportedYes
PostgreSQLSupportedYes
SQL ServerSupportedYes
SQLiteNot SupportedYes
SybaseSupportedYes
Sybase AnywhereSupportedYes