DbTrigger - do-/node-doix-db GitHub Wiki
DbTrigger is an DbObject descendant describing a DbTable's trigger.
Properties
| Name | Type | Value | Description |
|---|---|---|---|
table |
DbTable | Set automatically | The table this trigger belongs to |
name |
String |
Normally, generated, but may be set explicitly | Logical name of this trigger. |
options |
String |
'' by default |
The DDL text to place between CREATE and TRIGGER |
phase |
String |
MUST be set | The DDL text to place before ON |
action |
String |
'' (not FOR EACH ROW) by default |
The DDL text to place between ON and the trigger body |
sql |
String / null / function |
MUST be set | The trigger prodedure body source code (null to ingnore the trigger definition) or a function returning it being called with the DbTrigger instance available as this |
Sample fragment of a DbTable description file
{
/* CREATE */
// options: '',
/* TRIGGER ${qName} */
phase : 'BEFORE INSERT OR UPDATE',
/* ON ${table.qName} */
action : 'FOR EACH ROW /* WHEN TRUE */',
sql : `
/* trigger body */
`,
},