Adding a new column to a live database is not a simple code change. It can block writes, lock tables, and cascade failure through dependent services. The wrong approach can cost uptime, speed, and data integrity. The right approach runs in seconds with zero downtime.
Start by defining the new column in a migration script. Use ADD COLUMN with default values set to NULL when possible to avoid expensive table rewrites. If a backfill is required, run it in small batches to keep the system responsive.
Avoid adding non-null constraints until after the column has been populated. Split schema changes into multiple steps: create the column, populate it, then enforce constraints. This reduces lock duration and improves rollback safety.
On high-traffic systems, run migrations off-peak or use online schema change tools like gh-ost or pt-online-schema-change. These tools build the new table layout in the background, then swap it with minimal interruption.