CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0054_synthetic_checks.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| b1be050 | 1 | -- BLOCK S4 — Synthetic monitor history. |
| 2 | -- | |
| 3 | -- The autopilot ticker hits each row in SYNTHETIC_CHECKS (in | |
| 4 | -- src/lib/synthetic-monitor.ts), records the outcome here, and fires a | |
| 5 | -- webhook alert on any green->red transition. Strictly additive: nothing | |
| 6 | -- else reads or writes this table. | |
| 7 | ||
| 8 | CREATE TABLE IF NOT EXISTS synthetic_checks ( | |
| 9 | id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 10 | check_name text NOT NULL, | |
| 11 | status text NOT NULL, -- "green" | "red" | "yellow" | |
| 12 | status_code integer, -- HTTP status if applicable | |
| 13 | duration_ms integer NOT NULL, | |
| 14 | error text, -- non-null when red | |
| 15 | checked_at timestamptz NOT NULL DEFAULT now() | |
| 16 | ); | |
| 17 | ||
| 18 | CREATE INDEX IF NOT EXISTS idx_synthetic_checks_checked_at | |
| 19 | ON synthetic_checks (checked_at DESC); | |
| 20 | ||
| 21 | CREATE INDEX IF NOT EXISTS idx_synthetic_checks_name_checked_at | |
| 22 | ON synthetic_checks (check_name, checked_at DESC); |