The migration failed at midnight because the schema was out of sync. A single missing new column halted the deploy, locked connections, and triggered rollbacks.
Adding a new column should be simple. In modern databases, it still carries risk. The problem is not just DDL syntax — it’s performance impact, locking, replication lag, and downstream integrations. Every ALTER TABLE operation can affect production if not planned.
When introducing a new column, decide if it must allow NULL, have a default value, or be indexed. Defaults on large tables can rewrite every row, causing locks. Without defaults, application code must handle nulls. For indexed columns, build the index concurrently when your database supports it. Avoid blocking writes.
Use transactional DDL where possible. In PostgreSQL, adding a new column without a default is fast. Setting a default after creation is safe for large datasets. In MySQL, check the storage engine and version; some operations require a full table copy.