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

Creates a stored trigger

Available Attributes

NameDescription
catalogNameName of the catalogSupported by: asany, db2, db2z, derby, firebird, h2, hsqldb, informix, ingres, mariadb, mysql, oracle, postgresql, sqlite, sybaseE.g. 'cat'
commentsE.g. 'A String'
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.1E.g. 'h2, oracle'
disabledboolean
encodingName of the encoding (as specified in java.nio.Charset javadoc) used in the file defined in the `path` attributeDefault: 'utf-8'
pathFile containing the procedure text. Either this attribute or a nested procedure text is required.E.g. 'com/example/my-logic.sql'
[XML: text content] / procedureTextE.g. 'CREATE OR REPLACE PROCEDURE testHello IS BEGIN DBMS_OUTPUT.PUT_LINE('Hello From The Database!'); END;'Note: the content of the tag in XML
relativeToChangelogFilebooleanWhether the file path is relative to the root changelog file rather than to the classpath.
replaceIfExistsboolean
schemaNameName of the schemaE.g. 'public'
scopeE.g. 'A String'
tableNameName of the tableE.g. 'person'
[XML: text content] / triggerBodyE.g. 'A String'Note: the content of the tag in XML
triggerNameName of the trigger to dropE.g. 'A String'
<changeSet author="liquibase-docs" id="createTrigger-example">
    <pro:createTrigger catalogName="cat"
            comments="A String"
            dbms="h2, oracle"
            disabled="true"
            encoding="utf8"
            path="com/example/my-logic.sql"
            relativeToChangelogFile="true"
            replaceIfExists="false"
            schemaName="public"
            scope="A String"
            tableName="person"
            triggerName="A String">A String</pro:createTrigger>
</changeSet>
changeSet:
  id: createTrigger-example
  author: liquibase-docs
  changes:
  - createTrigger:
      catalogName: cat
      comments: A String
      dbms: h2, oracle
      disabled: true
      encoding: utf8
      path: com/example/my-logic.sql
      procedureText: |-
        CREATE OR REPLACE PROCEDURE testHello
            IS
            BEGIN
              DBMS_OUTPUT.PUT_LINE('Hello From The Database!');
            END;
      relativeToChangelogFile: true
      replaceIfExists: false
      schemaName: public
      scope: A String
      tableName: person
      triggerBody: A String
      triggerName: A String
{
  "changeSet": {
    "id": "createTrigger-example",
    "author": "liquibase-docs",
    "changes": [
      {
        "createTrigger": {
          "catalogName": "cat",
          "comments": "A String",
          "dbms": "h2, oracle",
          "disabled": true,
          "encoding": "utf8",
          "path": "com/example/my-logic.sql",
          "procedureText": "CREATE OR REPLACE PROCEDURE testHello\n    IS\n    BEGIN\n      DBMS_OUTPUT.PUT_LINE('Hello From The Database!');\n    END;",
          "relativeToChangelogFile": true,
          "replaceIfExists": false,
          "schemaName": "public",
          "scope": "A String",
          "tableName": "person",
          "triggerBody": "A String",
          "triggerName": "A String"
        }
      }]
    
  }
}

Database Support

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