RI Type Override Templates
You can use an RI Type Override template to change the behavior of the built-in template for an RI Trigger Type. For example, when you delete a row in the parent CUST_ORDER table, you want to use the default Parent-Delete CASCADE trigger code to delete the associated child rows in the ORDER_LINE table. In addition, you want to capture the deleted information and insert the deleted rows into a historical archive table any time a Parent-Delete CASCADE is performed, so you can retrieve the information at a later date.
One way to capture the behavior is to change the built-in Parent-Delete CASCADE trigger to perform the archiving by creating an RI Type Override. Here are some reasons why you might want to use an RI Type Override to change default trigger behavior:
- You only have to add a few lines of code to the trigger.
- You change the code in one place.
- The change is made throughout the database to all relationships with Parent-Delete CASCADE specified.
- The change never impacts the source code of any application.
- If you decide to stop archiving the information, you can easily change the original built-in template back to the default Parent-Delete CASCADE trigger type.
Creating an RI Type Override template makes it easy to produce custom referential integrity triggers because all relationships that are assigned the overridden RI trigger type automatically use that template.
Note: An RI Type Override template changes the behavior of all the attached triggers in a model.
Copyright © 2018 erwin, Inc.
All rights reserved.
|
|