Adding a new column sounds simple. In production, it can break everything. The right approach protects uptime and data integrity. The wrong approach costs hours, or days, of recovery.
Start with your database change strategy. Use migrations that are backward compatible. Deploy the schema change first without altering application code. Let both the old and new columns coexist if needed. This ensures the running app won’t crash when the schema updates propagate.
For PostgreSQL, ALTER TABLE ... ADD COLUMN is straightforward, but watch for default values on large tables. Adding a column with a non-null default can lock the table for minutes or hours. Create the column as nullable, then backfill in small batches. Only after the backfill should you add the NOT NULL constraint.
In MySQL, online DDL options allow adding columns without blocking reads and writes, but engine and version matter. Test on realistic data to confirm the change window. Use tools like pt-online-schema-change or gh-ost for safety.