-- Migration 005 — the editable decode map (AGENTS.md §4 FR-17, §7). -- -- Compass writes a lesson as "[period] - [subject code] - [room code] - -- [teacher initials]", for example "1 - 7SCF - H14LAB - KNI". The brief must -- read that as plain English ("Period 1 — Year 7 Science — Room H14LAB — Mr -- KNI"), so the mapping is data, not code. School codes change between years, -- so the table is editable and the seed only fills the gaps. -- -- A code that is not in the table renders as the raw Compass code, never blank. CREATE TABLE IF NOT EXISTS codes ( id INTEGER PRIMARY KEY, kind TEXT NOT NULL CHECK (kind IN ('subject', 'room', 'teacher', 'period')), code TEXT NOT NULL, name TEXT NOT NULL, updated_at TEXT NOT NULL DEFAULT (datetime('now')), UNIQUE (kind, code) ); CREATE INDEX IF NOT EXISTS idx_codes_kind ON codes(kind, code);