The schema broke when we pushed the migration. That’s when we knew we needed a new column.
Adding a new column sounds trivial. It isn’t. Done wrong, it can lock tables, stall deployments, and break production under load. Done right, it preserves uptime, keeps queries fast, and plays nice with your ORM and application code.
The first step is to define the new column clearly in your database schema. Use the correct data type. Decide if it can be NULL. Avoid default values that force an expensive table rewrite. In PostgreSQL, for example, adding a nullable column without a default is near-instant. Adding a column with a default rewrites the table and can block reads and writes.
Plan how the application will write to the new column. Deploy the schema change before writing to it. Backfill data in small batches with an indexed write path. Monitor query plans to make sure the new column doesn’t trigger unexpected full table scans.