Note: This is a Liquibase Pro Change Type, so you need a Liquibase Pro License Key to use it.

The createTrigger Change Type creates the trigger in a database.


You can typically use the createTrigger Change Type when you want to add a trigger to the table which will be automatically activated when a specific event occurs in your database. It can include catalog, schema, and table name attributes listed in this documentation.

Running the createTrigger Change Type

To create a trigger in your database, follow these steps:

Step 1: Add the createTrigger Change Type to your changeset with the needed attributes as it is shown in the examples.

Step 2: Deploy your changeset by running the update command.

liquibase update

Now, you should see that the trigger you've specified is added.

Available attributes

Name Description Required for Supports Since

Name of the catalog

asany, db2, db2z, derby, firebird, h2, hsqldb, informix, ingres, mariadb, mysql, oracle, postgresql, sqlite, sybase
dbms The logical expression of database type(s) on which the change must be applied. Valid database type names are listed on the supported databases page. You can specify the following:
  • A comma-separated list of multiple databases.
  • A change that is not applicable to a particular database type by prefixing with !.
  • The keywords all and none.
all 3.1
disabled Disables the trigger. all
encoding You can use this in a file defined in the path attribute. all
path The file containing the procedure text. You need to specify the path attribute or a nested procedure text. all all
procedureText The SQL creating the procedure. You need to specify the procedureText or the path attribute. all all
relativeToChangelogFile Defines whether the file path is relative to the changelog file rather than looked up in the search path. all
replaceIfExists Alters the stored procedure defined by procedureName if it already exits. mariadb, mssql, mysql

Name of the schema

scope The name of the module for a trigger. all
tableName The name of the table. all
triggerBody The body of the trigger. all all
triggerName The name of the trigger to create. all all

Database support

Database Notes Auto Rollback
DB2/LUW Supported Yes
DB2/z Supported Yes
Derby Supported Yes
Firebird Supported Yes
H2 Supported Yes
HyperSQL Supported Yes
INGRES Supported Yes
Informix Supported Yes
MariaDB Supported Yes
MySQL Supported Yes
Oracle Supported Yes
PostgreSQL Supported Yes
Snowflake Not Supported No
SQL Server Supported Yes
SQLite Supported Yes
Sybase Supported Yes
Sybase Anywhere Supported Yes