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.
| Field | Value |
|---|---|
| Severity | SEV-2 (thread membership broken ~3h 20m) |
| Category | Database & Migrations |
| Date | 2026-03-28 |
| Status | Archived |
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.
Customer impact
Section titled “Customer impact”- 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
Root cause
Section titled “Root cause”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.
Detection
Section titled “Detection”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.
What was done
Section titled “What was done”| Action | Status |
|---|---|
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 |
Lessons
Section titled “Lessons”- Drizzle’s flexibility is a footgun for renames — variable name and SQL table name are independent
- Logs without stack traces multiply incident duration
- Multi-step changes need a checklist
- Customer-reported is too slow — TTD 45min, need automated alerting on error spikes