The migration failed on the last step, and the logs showed a single red error: “no such column.”
Adding a new column sounds simple. It is not. Whether you’re working in PostgreSQL, MySQL, or SQLite, the wrong migration strategy can lock tables, block writes, and cause downtime. The cost is high when a schema change blocks critical transactions.
A new column should be created with precision. First, define its purpose and default behavior. Adding a nullable column is safest for large datasets because it avoids full table rewrites. In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast if no default is set. In MySQL, certain operations may trigger full table copies unless you use algorithms like INSTANT where supported. In SQLite, adding columns is straightforward but limited—only appends to the schema are allowed without rebuilding the table.
For live systems, always run migrations behind feature flags or during maintenance windows. Use transactional DDL if supported to ensure atomicity. Monitor query performance before and after the change; even small changes can affect indexes, join performance, and query plans.