The schema is live. You run the migration. You need a new column.
Adding a new column sounds simple. Done wrong, it will halt production, lock tables, and block writes. Done right, it’s seamless, invisible to users, and safe for scale.
The first step is to assess the impact. Check table size, index usage, and query load. On massive tables, a simple ALTER TABLE without precautions can cause catastrophic downtime. Use tools built for online migrations, such as pt-online-schema-change or gh-ost, to stage the change without blocking traffic.
Define the new column with the right data type from the start. Changing types later can require a full table rewrite. Add defaults with care—on some engines, adding a default value writes that value to every row at once, causing heavy I/O. Consider nullable columns with application-level defaults to avoid bulk updates.