Show TOC

Rebuilding TriggersLocate this document in the navigation structure

PowerDesigner can rebuild triggers to ensure that they are attached to all tables joined by references to ensure referential integrity. You can instruct PowerDesigner to automatically rebuild triggers whenever a relevant change is made and you can manually rebuild triggers at any time.

Context

The Rebuild Triggers function creates new triggers based on template items that correspond to trigger referential integrity defined for references and sequence implementation for columns.

To instruct PowerDesigner to automatically rebuild triggers, select Start of the navigation path Tools Next navigation step Model Options End of the navigation path, click Start of the navigation path Model Settings Next navigation step Trigger End of the navigation path, select Automatically rebuild triggers, and click OK. PowerDesigner rebuilds all triggers and will, from now on, rebuild triggers whenever you make a relevant change in the model.

To rebuild triggers manually:

Procedure

  1. Select Start of the navigation path Tools Next navigation step Rebuild Objects Next navigation step Rebuild Triggers End of the navigation path
  2. Specify a rebuild mode. You can choose between:
    • Delete and Rebuild – all triggers attached to templates are deleted and rebuilt, including those to which you have made modifications

    • Preserve – only those triggers attached to templates that have not been modified are deleted and rebuilt. Any triggers that you have modified are preserved.

  3. The Trigger selection box shows an expandable tree view of trigger types. Expand the tree and select the types to rebuild. There are three levels in this tree:
    • All trigger types supported by the current DBMS

    • All trigger templates corresponding to the trigger types

    • All template items defined for each trigger template

    For example, in the list below, the two template items InsertChildParentExist and InsertTooManyChildren are used in the BeforeInsertTrigger template that is, in turn, used in all triggers with a time of Before and an event type of Insert:



  4. [optional] Click the Error Messages tab to define the types of error messages to generate (see Generating a User-Defined Error Message).
  5. [optional] Click the Selection tab to specify which tables to rebuild the triggers for.
  6. Click OK to begin the rebuild process.

    Progress is shown in the Output window. You can view the triggers that have been created from the Triggers tab of the table property sheet, or from the List of Triggers.

    Note

    If you change the target DBMS family, for example from Oracle to IBM DB2, triggers are automatically rebuilt.

    For information about rebuilding dependencies between triggers and other objects, see Tracing Trigger and Procedure Dependencies.