Adding a new column sounds simple. It is not. The wrong migration locks rows, blocks writes, and halts production. The right approach keeps traffic flowing while the schema changes in place.
First, define the column in your schema file or migration tool. Use explicit data types. Avoid defaults that trigger full-table rewrites. In PostgreSQL, adding a nullable column without a default is instant. Adding one with a constant default rewrites the entire table. That can freeze large datasets.
Second, backfill in small batches. Read a chunk, update with the new column value, commit, pause. Repeat until the column is populated. This avoids write amplification and keeps locks short.