Adding a new column sounds simple. It rarely is. The wrong migration at the wrong time can lock writes, stall reads, or trigger cascading failures. Modern systems demand that adding a column works without downtime, without data loss, and without blocking critical queries.
Start with precision. Define the column’s data type, nullability, and default value. Consider how existing rows will populate. A NULL default avoids bulk updates during migration, but may require handling in your application layer. A static default executes a full table write, which can destroy performance on large datasets.
Run schema changes in controlled phases. First, deploy the new column as nullable. Next, backfill data in small batches, monitoring query performance and replication lag. Then, deploy code that writes to both the old and new fields. Only after confirming consistency should you cut reads over to the new column.