1709a331d1
server/db/schema.pg.sql — the full Postgres DDL, every column defined up front (no ALTER-ordering fragility). SQLite→PG type mapping documented in-file (epoch-ms INTEGER→BIGINT, 0/1 flags→SMALLINT kept numeric so app code is unchanged, sizes→ BIGINT, audit rowid→GENERATED IDENTITY). Mirrors the three existing FKs and adds a new idx_messages_attachment (the /files auth scan we cached earlier becomes a keyed lookup). Validated against a throwaway Postgres 16: loads with no errors, 24 tables + 44 indexes created. Unwired — nothing uses it yet; the SQLite path is untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>