Previous Topic: Define a SAP ASE View TriggerNext Topic: Create erwin-Generated Triggers As Model Objects


Default Trigger Templates

erwin® Data Modeler includes a set of default referential integrity (RI) trigger templates that generate SQL code, so you do not have to manually enter the required SQL code on the server. If your target DBMS supports triggers, default trigger templates are included that correctly implement referential integrity according to the relationships in a model and the options that you select. Some examples of the default trigger templates are:

Each default trigger template contains text, SQL code, and macros that you can apply to any table or relationship in a model. The macros in the template act as placeholders. During schema generation, macros are expanded into physical table, column, and relationship names. Each macro derives its value based on the context of the relationship to which the template is attached. By attaching a template to a table that is either the PARENT or CHILD table in a relationship, you define the context for macro expansion.

Because there is a built-in template associated with each RI rule type, you can generate default trigger code for a model without any further work. If you use the default templates, the default trigger code is composed using a fixed internal scheme for combining the different built-in templates.

Note: In erwin® Data Modeler version r7.3 and later, you can select to treat erwin-generated triggers as model objects. In earlier versions of the product, referential integrity information for erwin-generated triggers was generated as a comment in the body of the trigger. This mechanism stripped out erwin-generated triggers and parsed the referential integrity constraints during a "round trip" of the data model. A "round trip" occurs when you forward engineer a model to a database or script, then reverse engineer that database or script back to the model. You can now select to both forward-engineer and reverse-engineer erwin-generated triggers.

The Trigger Template editor contains the following tabs:

More information:

Triggers

Default Trigger Templates Example

Create erwin-Generated Triggers As Model Objects