feat(store): add incidents, notification channels and delivery outbox

At most one open incident per monitor is enforced by a partial unique
index.

Refs #15, #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 01:23:37 +01:00
1 parent 4b4e134bfd
commit ffef63e586
9 files changed
+770 -11

No files matched your search

+6
View File
@@ -26,3 +26,9 @@ SELECT monitor_id, sum(total)::bigint AS total, sum(ok_count)::bigint AS ok_coun
FROM check_results_1h
WHERE org_id = $1 AND bucket >= $2
GROUP BY monitor_id;
-- name: LatestResultsForMonitor :many
SELECT DISTINCT ON (region) region, ok, error
FROM check_results
WHERE org_id = $1 AND monitor_id = $2 AND time > now() - interval '1 day'
ORDER BY region, time DESC;