The migration crashed halfway. The logs showed a single error: missing new column.
Adding a new column to a database table should be simple. It can be, if done right. The wrong approach risks downtime, broken queries, and inconsistent data. Large production systems make schema changes dangerous. A single ALTER TABLE can lock rows, block writes, and stall critical services.
The safe path starts with understanding how your database engine handles column changes. In MySQL, adding a nullable column with a default value may rewrite the entire table. PostgreSQL can add certain columns instantly, but defaults require a table rewrite. In both, adding a non-null column without a default will fail if rows exist.
Plan your new column migration in steps. First, add the column as nullable. Then backfill data in small batches, avoiding long locks. Once all rows contain valid values, set constraints. This avoids downtime and keeps the system responsive.