← All writing

· 4 min read

The column that did not exist: an outage from schema and code drifting apart

A merge ran one migration ahead of production and the owner app failed on a missing column. What broke, why the fix took hours, and the rule it left behind.

In August I merged an authorization change that read a new column. Production was one migration behind. The first signal was an unclear error while loading the user theme.

What broke

Postgres raised a missing-column error (Prisma P2022). The screen was fine. The code had run ahead of the schema, nothing more.

Two deploy orders
All good

Why it took hours

Checking migration status through the pooled connection hung. The direct connection was not reachable from the environment I was working in. The way out was an SSH tunnel to the database. Those two things are what slowed the fix.

The pending migrations went in that same day. They were additive, and the incident record reports no data loss.

The second finding

While checking, six newer tables turned out to have row-level security switched off. A forward-only migration closed it, and the record names the rule that was missing: a new table enables security in the same migration that creates it.

What stayed

The incident record, and two rules it wrote down: a new table turns on row-level security in the same migration, and merging a schema change does not finish the job, because the migration has to run in production before the app that needs it, or together with it.

Read the case study →