The migration was live, and the schema needed change. A new column had to be added without breaking production.
Adding a new column sounds trivial. It is not. In high-traffic systems, database changes carry risk. Locking tables, triggering rebuilds, or causing slow queries can cascade into downtime. The right approach avoids these traps.
First, define the new column with clear constraints. Use the correct data type, precision, and default values. Plan for nullability. If you add a NOT NULL column with no default, existing rows will fail insertion until you backfill. This is the most common mistake.
Second, choose the safest migration method for your database. In PostgreSQL, ALTER TABLE ADD COLUMN is fast when adding nullable fields. For MySQL, adding columns can cause table copies depending on storage engine. Examine your execution plan in staging before production. Test with the same data volume to see locking behavior.
Third, manage the rollout in steps.