feat(alerting): Plan 02 — backend (domain, storage, evaluators, dispatch) #140
@@ -0,0 +1,7 @@
|
|||||||
|
-- V13 — Unique partial index: at most one open alert_instance per rule
|
||||||
|
-- Prevents duplicate FIRING rows in multi-replica deployments.
|
||||||
|
-- The Java save() path catches DuplicateKeyException and log-and-skips the losing insert.
|
||||||
|
CREATE UNIQUE INDEX alert_instances_open_rule_uq
|
||||||
|
ON alert_instances (rule_id)
|
||||||
|
WHERE rule_id IS NOT NULL
|
||||||
|
AND state IN ('PENDING','FIRING','ACKNOWLEDGED');
|
||||||
Reference in New Issue
Block a user