Previous Topic: Default Trigger Templates ExampleNext Topic: RI Type Override Templates


Methods to Override Trigger Templates

If you want to change the trigger code that is generated by a built-in template, you can customize the template and specify that the customized version should override the built-in template when you generate the schema.

Use one of the following methods to override the default trigger template:

RI Type Override Template

For each referential integrity rule combination, you can create a custom override template and use it instead of the default template for all the relationships in a model that have been assigned that RI rule type. When you use the built-in template code as a starting point, you can make global RI changes by changing the trigger code in only one place. When you generate the schema, referential integrity type override templates are used instead of the original default templates if you select the RI Type Override check box for triggers.

Relationship Override Template

If you want to override the default template for a particular relationship, you can change the built-in template and attach the override version to just that relationship. For example, if the relationship between the MOVIE and MOVIE_COPY tables is set for Parent-Delete RESTRICT and you want to override the behavior for the relationship, you can create a relationship override trigger template for the Parent-Delete RESTRICT combination and attach the override template to the MOVIE--MOVIE-COPY relationship. When you generate the schema, relationship override templates are used instead of the original default templates (and RI Type Override template if one exists) if you select the Relationship Override check box for triggers.

Table Override Template

For any table in a model, you can create custom table override triggers. When you generate the schema, table override templates are used instead of the built-in templates and any RI type override or relationship override templates you create.

Note: You must select the User Defined check box for triggers during schema generation to generate a table override in the schema.

More information:

RI Type Override Templates

Relationship Override Templates

Table Override Templates