fix: idempotent migrations (ADD COLUMN IF NOT EXISTS), stale doc, safety note

This commit is contained in:
atlas 2026-07-10 16:25:02 +02:00 committed by mara
commit c47faf0af9
5 changed files with 80 additions and 26 deletions

View file

@ -39,13 +39,14 @@ CREATE INDEX IF NOT EXISTS idx_operator_questions_pending
/// past all known migrations.
const MIGRATIONS: &[&str] = &[
// v1: `multi` — checkbox-style multi-option questions.
"ALTER TABLE operator_questions ADD COLUMN multi INTEGER NOT NULL DEFAULT 0",
"ALTER TABLE operator_questions ADD COLUMN IF NOT EXISTS \
multi INTEGER NOT NULL DEFAULT 0",
// v2: `deadline_at` — optional TTL after which the watchdog auto-resolves.
"ALTER TABLE operator_questions ADD COLUMN deadline_at INTEGER",
"ALTER TABLE operator_questions ADD COLUMN IF NOT EXISTS deadline_at INTEGER",
// v3: `target` — recipient of the question. NULL = operator (back-compat
// default); non-null = peer-to-peer question. Dashboard's `pending()`
// filters on `target IS NULL` so peer questions never leak to the operator.
"ALTER TABLE operator_questions ADD COLUMN target TEXT",
"ALTER TABLE operator_questions ADD COLUMN IF NOT EXISTS target TEXT",
];
#[derive(Debug, Clone, Serialize)]