CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0080_incidents_and_status_subscribers.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.
| 873f13c | 1 | -- 0077 — Status page: incident history + subscriber list. |
| 2 | -- | |
| 3 | -- incidents: manually-filed or autopilot-detected outage records shown on | |
| 4 | -- the public /status page. severity: 'minor' | 'major' | 'critical'. | |
| 5 | -- status: 'investigating' | 'identified' | 'monitoring' | 'resolved'. | |
| 6 | -- | |
| 7 | -- status_subscribers: email addresses that have opted-in to receive alerts | |
| 8 | -- when a new incident is filed. Confirmation token is single-use; once | |
| 9 | -- the user clicks the verify link confirmed_at is set. | |
| 10 | ||
| 11 | CREATE TABLE IF NOT EXISTS "incidents" ( | |
| 12 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 13 | "title" text NOT NULL, | |
| 14 | "severity" text NOT NULL DEFAULT 'minor', | |
| 15 | "status" text NOT NULL DEFAULT 'resolved', | |
| 16 | "started_at" timestamptz NOT NULL DEFAULT now(), | |
| 17 | "resolved_at" timestamptz, | |
| 18 | "body" text, | |
| 19 | "created_at" timestamptz NOT NULL DEFAULT now(), | |
| 20 | "updated_at" timestamptz NOT NULL DEFAULT now() | |
| 21 | ); | |
| 22 | ||
| 23 | CREATE INDEX IF NOT EXISTS "idx_incidents_started_at" | |
| 24 | ON "incidents" ("started_at" DESC); | |
| 25 | ||
| 26 | CREATE INDEX IF NOT EXISTS "idx_incidents_status" | |
| 27 | ON "incidents" ("status"); | |
| 28 | ||
| 29 | CREATE TABLE IF NOT EXISTS "status_subscribers" ( | |
| 30 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 31 | "email" text NOT NULL UNIQUE, | |
| 32 | "confirmed_at" timestamptz, | |
| 33 | "confirm_token" text UNIQUE, | |
| 34 | "unsubscribe_token" text UNIQUE, | |
| 35 | "created_at" timestamptz NOT NULL DEFAULT now() | |
| 36 | ); | |
| 37 | ||
| 38 | CREATE INDEX IF NOT EXISTS "idx_status_subscribers_email" | |
| 39 | ON "status_subscribers" ("email"); |