-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Sukhwinder Dhillon <[email protected]>
- Loading branch information
1 parent
6d6bb0f
commit c18842d
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,40 @@ | ||
DROP TABLE incident_event; | ||
|
||
CREATE TABLE rule_routing ( | ||
id bigserial, | ||
rule_id bigint NOT NULL REFERENCES rule(id), | ||
position integer NOT NULL, | ||
condition text, | ||
name text, -- if not set, recipients are used as a fallback for display purposes | ||
|
||
CONSTRAINT pk_rule_routing PRIMARY KEY (id), | ||
|
||
UNIQUE (rule_id, position) | ||
); | ||
|
||
CREATE TABLE rule_routing_recipient ( | ||
id bigserial, | ||
rule_routing_id bigint NOT NULL REFERENCES rule_routing(id), | ||
contact_id bigint REFERENCES contact(id), | ||
contactgroup_id bigint REFERENCES contactgroup(id), | ||
schedule_id bigint REFERENCES schedule(id), | ||
channel_id bigint REFERENCES channel(id), | ||
|
||
CONSTRAINT pk_rule_routing_recipient PRIMARY KEY (id), | ||
|
||
CHECK (num_nonnulls(contact_id, contactgroup_id, schedule_id) = 1) | ||
); | ||
|
||
CREATE TABLE notification_history ( | ||
id bigserial, | ||
incident_id bigint REFERENCES incident(id), | ||
rule_routing_id bigint REFERENCES rule_routing(id), | ||
contact_id bigint REFERENCES contact(id), | ||
contactgroup_id bigint REFERENCES contactgroup(id), | ||
schedule_id bigint REFERENCES schedule(id), | ||
channel_id bigint REFERENCES channel(id), | ||
time bigint NOT NULL, | ||
notification_state notification_state_type, | ||
sent_at bigint, | ||
message text | ||
); |