Adding a new column is one of the most common schema changes in modern applications. It sounds simple, but the wrong approach can trigger downtime, lock tables, and break production traffic. The right approach makes the change invisible to users and safe for operations.
First, define the purpose of the new column. Decide its name, data type, default value, and whether it allows nulls. Keep the definition consistent with your data model standards. Small mistakes here cascade into technical debt later.
Next, choose the method to apply the change. On small datasets, an ALTER TABLE ADD COLUMN statement might be enough. On high-volume systems, consider online schema change tools like pt-online-schema-change or gh-ost to avoid blocking writes.
Populate the column in controlled steps. For static defaults, use the default constraint so that new rows get populated automatically. For existing rows, backfill data in batches to reduce load on the database. Test these steps in a staging environment that mirrors production scale.