@@ -244,6 +244,31 @@ CREATE TABLE rule_escalation_recipient (
244
244
CHECK (num_nonnulls(contact_id, contactgroup_id, schedule_id) = 1 )
245
245
);
246
246
247
+ CREATE TABLE rule_routing (
248
+ id bigserial ,
249
+ rule_id bigint NOT NULL REFERENCES rule(id),
250
+ position integer NOT NULL ,
251
+ condition text ,
252
+ name text , -- if not set, recipients are used as a fallback for display purposes
253
+
254
+ CONSTRAINT pk_rule_routing PRIMARY KEY (id),
255
+
256
+ UNIQUE (rule_id, position)
257
+ );
258
+
259
+ CREATE TABLE rule_routing_recipient (
260
+ id bigserial ,
261
+ rule_routing_id bigint NOT NULL REFERENCES rule_routing(id),
262
+ contact_id bigint REFERENCES contact(id),
263
+ contactgroup_id bigint REFERENCES contactgroup(id),
264
+ schedule_id bigint REFERENCES schedule(id),
265
+ channel_id bigint REFERENCES channel(id),
266
+
267
+ CONSTRAINT pk_rule_routing_recipient PRIMARY KEY (id),
268
+
269
+ CHECK (num_nonnulls(contact_id, contactgroup_id, schedule_id) = 1 )
270
+ );
271
+
247
272
CREATE TABLE incident (
248
273
id bigserial ,
249
274
object_id bytea NOT NULL REFERENCES object(id),
@@ -310,3 +335,17 @@ CREATE TABLE incident_history (
310
335
311
336
CREATE INDEX idx_incident_history_time_type ON incident_history(time , type);
312
337
COMMENT ON INDEX idx_incident_history_time_type IS ' Incident History ordered by time/type' ;
338
+
339
+ CREATE TABLE notification_history (
340
+ id bigserial ,
341
+ incident_id bigint REFERENCES incident(id),
342
+ rule_routing_id bigint REFERENCES rule_routing(id),
343
+ contact_id bigint REFERENCES contact(id),
344
+ contactgroup_id bigint REFERENCES contactgroup(id),
345
+ schedule_id bigint REFERENCES schedule(id),
346
+ channel_id bigint REFERENCES channel(id),
347
+ time bigint NOT NULL ,
348
+ notification_state notification_state_type,
349
+ sent_at bigint ,
350
+ message text
351
+ );
0 commit comments