pub const MIGRATION_SQL: &str = "\
CREATE TABLE IF NOT EXISTS sync_cursors (
device_id TEXT PRIMARY KEY,
last_seq INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS sync_state (
key TEXT PRIMARY KEY,
value TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS cloud_outbox (
id INTEGER PRIMARY KEY AUTOINCREMENT,
operation TEXT NOT NULL CHECK (operation IN ('upload', 'delete')),
file_id TEXT NOT NULL,
cloud_key TEXT NOT NULL,
source_path TEXT,
created_at TEXT NOT NULL,
min_seq INTEGER,
UNIQUE(operation, cloud_key)
);
";Expand description
SQL that creates coven’s bookkeeping tables. The host applies this alongside
its own schema migration. Idempotent (IF NOT EXISTS).