Add a NOT NULL Column to a 50M-Row Prod Table
A migration adds a NOT NULL column to a huge live table. A teammate wants to run the ALTER directly. Defend the safe path.
the decision you defend
You need to add a NOT NULL column with a default to a 50 million row table in production. A teammate wants to just run the ALTER TABLE during business hours. How do you do this without taking the app down?
the situation
A feature needs a new required column on your busiest table, which has about 50 million rows and serves constant reads and writes from the live app.
context
The table is the hot path for the product. You are on PostgreSQL with read replicas. A teammate wants to ship the migration as a single ALTER TABLE that adds the column with a default and a NOT NULL constraint, run during the workday to keep things simple.
How this challenge works
Take a position on the decision above and defend it. A senior-engineer AI will push back over up to 5 rounds. When you are done, you are scored against a verified rubric so you can see exactly what a complete answer covers - these are learning prompts, not gotchas.