···11+CREATE TABLE incidents (
22+ id INTEGER PRIMARY KEY AUTOINCREMENT,
33+ service_id TEXT NOT NULL,
44+ title TEXT NOT NULL,
55+ status TEXT NOT NULL CHECK (status IN ('investigating', 'identified', 'monitoring', 'resolved')),
66+ severity TEXT NOT NULL CHECK (severity IN ('critical', 'major', 'minor')),
77+ triage_report TEXT,
88+ started_at INTEGER NOT NULL,
99+ resolved_at INTEGER,
1010+ created_at INTEGER NOT NULL,
1111+ updated_at INTEGER NOT NULL
1212+);
1313+1414+CREATE TABLE incident_updates (
1515+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1616+ incident_id INTEGER NOT NULL REFERENCES incidents(id),
1717+ status TEXT NOT NULL,
1818+ message TEXT NOT NULL,
1919+ created_at INTEGER NOT NULL
2020+);
2121+2222+CREATE INDEX idx_incidents_service ON incidents (service_id, status);
2323+CREATE INDEX idx_incidents_active ON incidents (status) WHERE status != 'resolved';
2424+CREATE INDEX idx_incident_updates ON incident_updates (incident_id, created_at DESC);