Adding a new column to a database is simple in syntax but heavy in consequence. It alters storage, queries, indexes, and sometimes application logic. One migration can ripple through every service, API, and downstream consumer touching that table.
Start by defining the new column with the correct data type and constraints. Use ALTER TABLE for relational databases like PostgreSQL and MySQL. For large datasets, consider whether the operation will lock the table or make the service unresponsive. Online schema change tools (such as gh-ost or pg_online_alter_table) can keep production traffic flowing while the new column is applied.
Plan how the column will be populated. Backfilling millions of rows inside the same transaction can overload your database. Break the backfill into batches, track progress, and measure query impact. If the column holds a default value, be aware of how this interacts with existing rows.