Previous Topic: Delete an RI Type Override Trigger TemplateNext Topic: Create a Relationship Override Trigger Template


Relationship Override Templates

You should try to design triggers so that they function the same way throughout a model. However, sometimes you may need to create a Relationship Override Template to change the built-in trigger for an individual relationship, rather than changing all of the relationships assigned to the associated RI trigger type.

For example, when you try to delete a row in the parent CUST_ORDER table, you may want to use the default Parent-Delete RESTRICT trigger code to verify that there are no unfilled line items in the order. If there are unfilled line items, you can use the default trigger code to prevent deletion of the order. In this example, you may also want the referential integrity trigger to automatically change the value in the order_status column to "Outstanding."

If you change the built-in trigger to perform the action by creating a Relationship Override for the Parent-Delete RESTRICT trigger, the template is applied only to the relationship between the CUST_ORDER and ORDER_LINE tables. Although changing how referential integrity is enforced for individual relationships can make database maintenance more difficult, using a Relationship Override lets you support unique business rules for specific relationships.

More information:

Create a Relationship Override Trigger Template

Example: Relationship Override Template