flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/status/migrations/0001_init.sql

55 lines1,650 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas1-- The status page's own record: each part's last check, a day-by-day
2-- tally for the 90-day bars, and incidents posted from sudo.
3
4-- Each part at its last check.
5CREATE TABLE current (
6 component TEXT PRIMARY KEY,
7 state TEXT NOT NULL,
8 detail TEXT NOT NULL,
9 latency_ms INTEGER,
10 checked_at TEXT NOT NULL
11);
12
13-- One row per part per UTC day: how many checks, and how they went.
14-- Rows older than 90 days are deleted as checks run.
15CREATE TABLE daily (
16 component TEXT NOT NULL,
17 day TEXT NOT NULL,
18 checks INTEGER NOT NULL DEFAULT 0,
19 up INTEGER NOT NULL DEFAULT 0,
20 degraded INTEGER NOT NULL DEFAULT 0,
21 down INTEGER NOT NULL DEFAULT 0,
22 latency_total INTEGER NOT NULL DEFAULT 0,
23 latency_count INTEGER NOT NULL DEFAULT 0,
24 PRIMARY KEY (component, day)
25);
26CREATE INDEX daily_day ON daily (day);
27
28-- When the parts were last checked, as a whole.
29CREATE TABLE meta (
30 key TEXT PRIMARY KEY,
31 value TEXT NOT NULL
32);
33
34CREATE TABLE incidents (
35 id TEXT PRIMARY KEY,
36 title TEXT NOT NULL,
37 impact TEXT NOT NULL CHECK (impact IN ('degraded', 'down')),
38 status TEXT NOT NULL CHECK (status IN ('investigating', 'identified', 'monitoring', 'resolved')),
39 -- A JSON array of component keys.
40 components TEXT NOT NULL,
41 started_at TEXT NOT NULL,
42 resolved_at TEXT,
43 created_by TEXT NOT NULL
44);
45CREATE INDEX incidents_started ON incidents (started_at);
46
47CREATE TABLE incident_updates (
48 id TEXT PRIMARY KEY,
49 incident_id TEXT NOT NULL REFERENCES incidents (id),
50 status TEXT NOT NULL,
51 message TEXT NOT NULL,
52 at TEXT NOT NULL,
53 by TEXT NOT NULL
54);
55CREATE INDEX incident_updates_incident ON incident_updates (incident_id, at);