Adding a new column is not a minor change. It has ripple effects across your database, application logic, and performance. Done right, it keeps the system stable and scalable. Done wrong, it can cause silent data corruption, long locks, and outages.
Start with the database. Decide the column’s type, nullability, and default value. Understand how it fits into existing queries. In relational databases like PostgreSQL or MySQL, adding a non-null column without a default will block writes until every row is updated. For large tables, this can be catastrophic. Use NULL with a default for zero-downtime migrations, or create the column in stages.
Next, update the application layer. Migrations must match code changes exactly. If you ship code that expects the new column before the migration completes, you’ll hit runtime errors. Ship safe. Add the column first, deploy code that writes to it, backfill in the background, then make it required.