The migration failed without warning. Logs showed mismatched schemas. The new column you thought was deployed never existed in production.
Adding a new column to a database sounds trivial. It isn’t. Schema changes carry real risk: downtime, data loss, broken queries. In high-traffic systems, the smallest mistake can cascade into outages.
When introducing a new column, start by defining it in a migration file with explicit type, nullability, and default value. Never rely on database defaults you haven’t documented. Run migrations in a controlled environment first. Capture slow query logs to see if indexes are needed before production release.
Deploy schema changes in stages. First, add the new column with a safe default. Backfill data in small batches to avoid locking tables. Then, update application code to read from and write to it. Only after verifying reads and writes should you drop any deprecated columns.