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

Inserts data into an existing table

Available Attributes

NameDescription
catalogNameName of the catalog@ v3.0E.g. 'cat'
dbmsLogical expression of database type(s) on which the change must be applied. Valid database type names are listed on the supported databases page It can be a comma separated list of multiple databases. Or You can also specify that a change is NOT applicable to a particular database type by prefixing with !. The keywords all and none are also available.@ v3.0E.g. '!h2, mysql'
schemaNameName of the schemaE.g. 'public'
tableNameName of the table to insert data intoE.g. 'person'

Nested Properties

NameDescription
columns / column [1..N]Data to insert into columnsNote: columns tag not required in XML
Attributes
name Name of the column to set
value New value of the column.
Note: If not set the first valueXXX defined is used in the order they appear.
valueNumeric integer value of the column.
valueBoolean boolean value of the column.
valueDate Date and/or Time value to set the column to. The value is specified in one of the following forms: "YYYY-MM-DD", "hh:mm:ss" or "YYYY-MM-DDThh:mm:ss".
valueComputed A value that is returned from a function or procedure call. This attribute shall contain the function name to call.
valueBlobFile Path to a file, whose contents will be written as a BLOB (i.e. chunk of binary data). Must be either absolute or relative to the Change Log file location (absolute paths are, e.g.: /usr/local/somefile.dat on Unix or c:\Directory\somefile.dat on Windows. Please refer to java.io.File javadoc for the details of what to consider relative/absolute path).
valueClobFile Path to a file, whose contents will be written as a CLOB (i.e. chunk of character data). Must be either absolute or relative to the Change Log file location (absolute paths are, e.g.: /usr/local/somefile.daton Unix or c:\Directory\somefile.dat on Windows. Please refer to java.io.File javadoc for the details of what to consider relative/absolute path).
encoding Name of the encoding (as specified in java.nio.Charset javadoc) of the CLOB file (specified in valueClobFile) contents. Default: 'UTF-8'
Note: used only when valueClobFile attribute is specified, ignored otherwise.
<changeSet author="liquibase-docs" id="insert-example">
    <insert catalogName="cat"
            dbms="!h2, mysql"
            schemaName="public"
            tableName="person">
        <column name="address" value="address value"/>
    </insert>
</changeSet>
changeSet:
  id: insert-example
  author: liquibase-docs
  changes:
  - insert:
      catalogName: cat
      columns:
      - column:
          name: address
          value: address value
      dbms: '!h2, mysql'
      schemaName: public
      tableName: person
{
  "changeSet": {
    "id": "insert-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "insert": {
          "catalogName": "cat",
          "columns": [
            {
              "column": {
                "name": "address",
                "value": "address value"
              }
            }]
          ,
          "dbms": "!h2, mysql",
          "schemaName": "public",
          "tableName": "person"
        }
      }]
    
  }
}

SQL Generated From Above Sample (MySQL)

INSERT INTO cat.person (address) VALUES ('address value');

Database Support

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