PowerDesigner provides pre-defined template items for the trigger templates defined in each DBMS. The Rebuild Triggers function uses both pre-defined and user-defined trigger templates to automatically create triggers for selected tables.
In the pre-defined trigger templates, each pre-defined template item corresponds to a referential integrity constraint. Although a pre-defined template item is defined in a trigger template, it is only generated in a trigger script if it implements the trigger referential integrity defined for a reference. The item is available for generation if it is present on the Template Items tab of a trigger property sheet and will be generated if it is present on the Template Items tab of a trigger template property sheet.
The template items below implement referential integrity in insert trigger templates.
Template item |
Integrity constraint |
Description |
---|---|---|
DeclInsertChildParentExist InsertChildParentExist |
Mandatory parent |
Parent must exist when inserting a child |
DeclInsertTooManyChildren InsertTooManyChildren |
Cannot exceed maximum cardinality constraint |
Cannot insert a child if maximum cardinality has been reached |
DeclInsertSequenceColumn InsertSequenceColumn |
Select value in sequence list for column |
Select a value for the column from a list of sequences |
The template items below implement referential integrity in update trigger templates.
Template item |
Integrity constraint |
Description |
---|---|---|
DeclUpdateChildParentExist UpdateChildParentExist |
Mandatory parent |
Parent must exist when updating a child |
DeclUpdateChildChangeParent UpdateChildChangeParent |
Change parent not allowed |
Cannot modify parent code in child |
DeclUpdateParentRestrict UpdateParentRestrict |
Restrict on update |
Cannot modify parent if child exists |
DeclUpdateParentCascade UpdateParentCascade |
Cascade on update |
Modify parent code in all children |
DeclUpdateChangeColumn UpdateChangeColumn |
Non-modifiable column |
Cannot modify column |
DeclUpdateParentSetNull UpdateParentSetNull |
Set null on update |
Set parent code to null in all children |
DeclUpdateParentSetDefault UpdateParentSetDefault |
Set default on update |
Set parent code to default in all children |
DeclUpdateTooManyChildren UpdateTooManyChildren |
Cannot exceed maximum cardinality constraint |
Cannot update a child if maximum cardinality has been reached |
The template items below implement referential integrity in delete trigger templates.
Template item |
Integrity constraint |
Description |
---|---|---|
DeclDeleteParentRestrict DeleteParentRestrict |
Restrict on delete |
Cannot delete parent if child exists |
DeclDeleteParentCascade DeleteParentCascade |
Cascade on delete |
Delete parent code in all children |
DeclDeleteParentSetNull DeleteParentSetNull |
Set null on delete |
Delete in parent sets child to null |
DeclDeleteParentSetDefault DeleteParentSetDefault |
Set default on delete |
Delete in parent sets child to default |