Rebuilding Triggers

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.

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 Tools > Model Options, click Model Settings > Trigger, 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:

  1. Select Tools > Rebuild Objects > Rebuild Triggers
  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 Sybase to Oracle or IBM DB2, triggers are automatically rebuilt.

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