The migration finished, but the data looked wrong. A missing step. The new column was there in the schema, but empty, null, or worse—filled with bad defaults.
Adding a new column in production is never just an ALTER TABLE command. It changes storage, indexing, query plans, and possibly application behavior. Done right, it is seamless. Done wrong, it breaks features, corrupts reports, and hurts performance.
First, define the new column with precision. Choose the correct data type and constraints. Avoid defaults that hide missing data. If needed, make it nullable during the rollout, then backfill, then enforce constraints in a later deploy.
Second, understand database lock behavior. For large tables, adding a column can lock writes for minutes or hours. Use tools or database-specific strategies that perform schema changes online. Test them against realistic workloads.