The migration failed at row 9,247. The logs showed the reason in five blunt words: missing new column in schema.
Adding a new column should be simple. In reality, it can break production if planned poorly. Schema changes touch data integrity, service uptime, and deployment velocity. If the new column is non-nullable, default values matter. If it’s indexed, query performance can change. If it’s part of a critical table, the migration plan must be tested before release.
Start by defining the new column in a local development environment. Keep the type compatible with existing data flows. Avoid implicit conversions that slow down queries. Assign defaults only where they make logical sense; avoid silent data corruption through guesswork.
For large datasets, online schema migration tools reduce lock times and prevent blocking writes. In PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable types, but slower when adding non-null constraints with defaults. In MySQL, use pt-online-schema-change or native ALTER TABLE with caution to prevent downtime. Always run migrations within transactions where supported.