f3b6e67c19
Production runs DB_BACKEND=pg, but the message_hidden table (#18) and pinned_at/pinned_by columns (#13) were only added to the SQLite migrations in db.js — never to schema.pg.sql. So thread/conversations/pinned queries hit a missing relation/column and 500'd, which surfaced as "chat history removed" (no data was ever deleted — the reads just errored). pg.js init() runs schema.pg.sql on every boot. Added the message_hidden table and, because CREATE TABLE IF NOT EXISTS can't add columns to the existing messages table, idempotent ALTER TABLE ... ADD COLUMN IF NOT EXISTS for pinned_at/pinned_by. Restores all chat history and re-enables pin + delete-for-me. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>