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

Create Table

Available Attributes

NameDescription
catalogNameName of the catalog@ v3.0E.g. 'cat'
remarksComments stored for the tableE.g. 'A String'
schemaNameName of the schemaE.g. 'public'
tableNameName of the tableE.g. 'person'
tablespaceName of the tablespace, the table created inE.g. 'A String'

Nested Properties

NameDescription
columns / column [1..N]Column definitionsNote: columns tag not required in XML

See the column tag documentation for more information
<changeSet author="liquibase-docs" id="createTable-example">
    <createTable catalogName="cat"
            remarks="A String"
            schemaName="public"
            tableName="person"
            tablespace="A String">
        <column name="id" type="int">
            <constraints nullable="false"/>
        </column>
        <column name="address" type="varchar(50)"/>
    </createTable>
</changeSet>
changeSet:
  id: createTable-example
  author: liquibase-docs
  changes:
  - createTable:
      catalogName: cat
      columns:
      - column:
          constraints:
            nullable: false
          name: id
          type: int
      - column:
          name: address
          type: varchar(50)
      remarks: A String
      schemaName: public
      tableName: person
      tablespace: A String
{
  "changeSet": {
    "id": "createTable-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "createTable": {
          "catalogName": "cat",
          "columns": [
            {
              "column": {
                "constraints": {
                  "nullable": false
                },
                "name": "id",
                "type": "int"
              }
            },
            {
              "column": {
                "name": "address",
                "type": "varchar(50)"
              }
            }]
          ,
          "remarks": "A String",
          "schemaName": "public",
          "tableName": "person",
          "tablespace": "A String"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

CREATE TABLE cat.person (id INT NOT NULL,
 address VARCHAR(50) NULL) COMMENT='A String';

ALTER TABLE cat.person COMMENT = 'A String';

Database Support

DatabaseNotesAuto Rollback
DB2/LUWSupportedYes
DB2/zSupportedYes
DerbySupportedYes
FirebirdSupportedYes
H2SupportedYes
HyperSQLSupportedYes
INGRESSupportedYes
InformixSupportedYes
MariaDBSupportedYes
MySQLSupportedYes
OracleSupportedYes
PostgreSQLSupportedYes
SQL ServerSupportedYes
SQLiteSupportedYes
SybaseSupportedYes
Sybase AnywhereSupportedYes