The migration script failed. Not from syntax errors, but because the table structure was wrong. You forgot the new column.
Adding a new column sounds trivial. It’s not. In production, every schema change carries risk — data loss, locks, and downtime. The new column can save a system or break it. Precision matters.
Start with the requirements. Define the column name, type, default value, and constraints. If it’s nullable, know why. If it’s indexed, measure the cost. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but defaults on large tables can trigger full rewrites. In MySQL, adding a column can block writes depending on the storage engine. In distributed databases, every node must agree before a single transaction commits.
Version control your migrations. Never run ad-hoc ALTER TABLE commands in production shells. Use migration tools that generate deterministic scripts. Test the new column in staging with realistic data volumes. Benchmark query performance before and after, especially if the column participates in joins or filters.