The migration finished at 02:17, but the schema didn’t match. A new column was missing, and the deployment was already live.
Adding a new column sounds simple. In production, it can break writes, stall reads, and trigger unexpected cache misses. Whether you’re using PostgreSQL, MySQL, or a cloud-native database, understanding the right way to introduce a column is essential for stability.
First, design the new column with precision. Define the data type, constraints, and default values before touching production. Avoid adding expensive defaults that rewrite the entire table. For large datasets, use nullable columns or phased updates to reduce lock time.
Next, apply the schema change with minimal impact. In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast if no default is set. For MySQL, online DDL options like ALGORITHM=INPLACE can reduce downtime. Always test the migration script against a staging environment with production-scale data.