The database was live. Traffic was heavy. The margin for error was zero.
A new column can be simple, but it’s never trivial. Whether in PostgreSQL, MySQL, or modern distributed systems, you are altering both the schema and the expectations of every process that touches it. This change must be planned, indexed, and deployed without breaking read and write paths.
Start by defining the column with exact data types. Avoid generic types—precision keeps storage costs low and queries fast. Use NULL or NOT NULL intentionally. Defaults matter. A poorly chosen default can backfill millions of rows and lock the table for minutes or hours.
Run your migration in a way that avoids blocking. In PostgreSQL, use ALTER TABLE ... ADD COLUMN with DEFAULT only if you can afford the lock. Otherwise, add the column without a default, then backfill in controlled batches. In MySQL, assess whether your engine supports instant DDL; if not, schedule downtime or use online schema change tools like pt-online-schema-change.