Liquibase® version 3.8.2 is now available! Get it for free.
2018 XML Announcement
News 5 Ways to Fix a Bad Database Change in Liquibase
04 Dec 2019

- and/or -

All Previous Posts >>

Change: ‘dropNotNullConstraint’

Makes a column nullable

Available Attributes

NameDescriptionRequired ForSupportsSince
catalogNameName of the catalogall3.0
columnDataTypeCurrent data type of the columninformix, mariadb, mssql, mysqlall
columnNameName of the column to drop the constraint fromallall
schemaNameName of the schemaall
tableNameName of the table containing that the column to drop the constraint fromallall
<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
DB2Not SupportedYes
DB2SupportedYes
DerbySupportedYes
FirebirdNot SupportedYes
H2SupportedYes
HyperSQLSupportedYes
INGRESSupportedYes
InformixSupportedYes
MariaDBSupportedYes
MySQLSupportedYes
OracleSupportedYes
PostgreSQLSupportedYes
SQL ServerSupportedYes
SQLiteNot SupportedYes
SybaseSupportedYes
Sybase AnywhereSupportedYes