Skip to content

FM-032 — thread_members 42703 — Table Rename Missing pgTable String

Drizzle pgTable() first-arg string is the SQL table name. Renaming a table required updating 7 layers; one was missed.

FieldValue
SeveritySEV-2 (thread membership broken ~3h 20m)
CategoryDatabase & Migrations
Date2026-03-28
StatusArchived

A table was renamed in a migration but the pgTable() string literal in shared/schema/comms.ts wasn’t updated. Drizzle generated SQL still referenced the old table name. Any INSERT against the renamed table returned PostgreSQL 42703. Thread membership creation broke for ~3h until the schema string was patched.

  • Who: Users adding members to threads during the window
  • How: “Add to thread” silently failed; thread membership not persisted
  • Severity: Specific feature broken; no data loss; no cross-tenant exposure
  • Duration: ~3h 20m
  • Detection: Customer reported in #support after ~45 min

The Drizzle TypeScript variable name and the SQL table name are independent — pgTable('comms_thread_members', { ... }) is what hits the DB. The engineer renamed the SQL migration, TS variable, type exports, repository imports, API route paths, and client paths — but missed the pgTable() first argument.

Table renames in Drizzle require updating 7 separate layers atomically, and there was no checklist.

Customer report in #support, ~45 min after the deploy. Logs without stack traces ate 30+ min of investigation time — log.error('error during INSERT') had no SQL, no trace.

Updated pgTable() string to thread_members. Redeployed. Verified.

ActionStatus
Fix pgTable() string✅ Done
Add Table Rename Checklist to .claude/rules/autonomous-agent-rules.md✅ Done
Add ESLint rule cmmd/require-error-logging-stack requiring stack: in log.error✅ Done
Update Database Migrations standard with rename gotcha✅ Done
  1. Drizzle’s flexibility is a footgun for renames — variable name and SQL table name are independent
  2. Logs without stack traces multiply incident duration
  3. Multi-step changes need a checklist
  4. Customer-reported is too slow — TTD 45min, need automated alerting on error spikes