Altering database tables containing millions of rows can lock tables, causing site downtime. Applying schema changes online requires strategic design.
1. The Expand-and-Contract Pattern
Instead of renaming columns or altering datatypes directly, add a new column, copy records in chunks in background jobs, and then drop the old column.