-- KB spine: vector extension + frozen envelope schema -- Additive: new columns may be added but existing ones must not be removed or renamed. -- Version: 001 — initial CREATE EXTENSION IF NOT EXISTS vector; CREATE TABLE IF NOT EXISTS envelope ( id TEXT PRIMARY KEY, source TEXT NOT NULL, -- fastmail | gmail | ... ts TIMESTAMPTZ NOT NULL, -- message date, UTC geo JSONB, -- null for mails; filled by layer-3 enrich raw_ref TEXT NOT NULL, -- relative path to .eml in archive entities JSONB NOT NULL DEFAULT '[]' ); CREATE INDEX IF NOT EXISTS envelope_source_idx ON envelope (source); CREATE INDEX IF NOT EXISTS envelope_ts_idx ON envelope (ts);