feat(store): allow heartbeat monitors and find overdue ones

Refs #27

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 11:36:14 +01:00
1 parent 4635defef3
commit 04eff67e56
4 files changed
+125

No files matched your search

@@ -0,0 +1,13 @@
-- +goose Up
-- Heartbeat monitors are pinged by the monitored job instead of being
-- checked. Their target is the secret token of the ping URL.
ALTER TABLE monitors DROP CONSTRAINT monitors_type_check;
ALTER TABLE monitors ADD CONSTRAINT monitors_type_check
CHECK (type IN ('http', 'tcp', 'icmp', 'dns', 'tls', 'heartbeat'));
CREATE UNIQUE INDEX monitors_heartbeat_token_idx ON monitors (target) WHERE type = 'heartbeat';
-- +goose Down
DROP INDEX monitors_heartbeat_token_idx;
DELETE FROM monitors WHERE type = 'heartbeat';
ALTER TABLE monitors DROP CONSTRAINT monitors_type_check;
ALTER TABLE monitors ADD CONSTRAINT monitors_type_check CHECK (type IN ('http', 'tcp', 'icmp', 'dns', 'tls'));