The request was simple: add a new column. The database was live, the traffic constant, and the margin for error near zero. Every change had to be safe, fast, and transparent.
A new column sounds harmless, but in production it can be dangerous. Schema changes lock tables, block queries, and increase load. On high-scale systems, that can mean seconds or minutes of downtime. You can’t guess. You need a process.
First, define the purpose of the column. Know its data type, default, and nullability. Avoid broad types; pick the smallest type that works. Every byte matters.
Second, plan your migration path. In MySQL or PostgreSQL, adding a nullable column without a default is cheap. Adding a column with a default can rewrite the table. For large datasets, break the change into two steps: create a nullable column first, then backfill in batches, then add constraints.