my own status page
1-- Drop the old CHECK constraint and add new one with additional statuses
2-- SQLite doesn't support ALTER CONSTRAINT, so we recreate the table
3CREATE TABLE pings_new (
4 id INTEGER PRIMARY KEY AUTOINCREMENT,
5 service_id TEXT NOT NULL,
6 timestamp INTEGER NOT NULL,
7 status TEXT NOT NULL CHECK (status IN ('up', 'degraded', 'misconfigured', 'timeout', 'down', 'unknown')),
8 latency_ms INTEGER
9);
10
11INSERT INTO pings_new SELECT * FROM pings;
12
13DROP TABLE pings;
14
15ALTER TABLE pings_new RENAME TO pings;
16
17CREATE INDEX idx_pings_service_ts ON pings (service_id, timestamp DESC);