feat: project skeleton
- infra (k8s, kind, helm, docker) backbone is implemented - security: implementation + unit tests are done
This commit is contained in:
25
migrations/0003_notification_tables.sql
Normal file
25
migrations/0003_notification_tables.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Notification system tables
|
||||
-- Stores notification targets and delivery attempts
|
||||
|
||||
CREATE TABLE notification_targets (
|
||||
id UUID PRIMARY KEY,
|
||||
org_id UUID NOT NULL REFERENCES orgs(id),
|
||||
name TEXT NOT NULL,
|
||||
target_type TEXT NOT NULL CHECK (target_type IN ('webhook', 'email', 'slack')),
|
||||
webhook_url TEXT,
|
||||
enabled BOOLEAN NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_notification_targets_org ON notification_targets(org_id);
|
||||
|
||||
CREATE TABLE notification_attempts (
|
||||
id UUID PRIMARY KEY,
|
||||
incident_id UUID NOT NULL REFERENCES incidents(id),
|
||||
target_id UUID NOT NULL REFERENCES notification_targets(id),
|
||||
status TEXT NOT NULL CHECK (status IN ('pending', 'sent', 'failed')),
|
||||
error TEXT,
|
||||
sent_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
UNIQUE (incident_id, target_id)
|
||||
);
|
||||
Reference in New Issue
Block a user