Adding a new column is one of the most common schema changes in any database. It sounds simple, but mistakes here can cost uptime, performance, and trust. Whether you are working with PostgreSQL, MySQL, or another relational database, the process must be deliberate and precise.
First, define the purpose of the new column. Decide the name, data type, default value, constraints, and whether it supports NULL. Any ambiguity will ripple through your application code and data pipelines.
Second, plan the migration. In production, adding a new column with a default value can lock the table and block writes. In PostgreSQL, this happens if the default is not a constant. In large tables, the impact can be significant. The safe pattern is to add the column as nullable, backfill data in small batches, and then apply the constraint.
Third, update your application to handle the new column gracefully. Deploy application changes before the migration when the column is nullable. This allows a zero-downtime rollout.