The migration fails halfway. You check the logs. The error is clear: the table schema doesn’t match the data. You need a new column.
Adding a new column should be simple, but it’s where small mistakes cause big outages. Schema changes hit production databases hard when they’re not planned. Slow queries, locked tables, even lost writes—it all happens when changes deploy without thought.
First, decide if the new column is nullable or has a default value. In large tables, a non-null column with no default will lock writes during the update. Use ALTER TABLE ... ADD COLUMN with a safe default to avoid downtime. In PostgreSQL, adding a nullable column is instant. Adding one with DEFAULT is fast if the default is a constant. Anything else can force a rewrite of the whole table.
Second, create an index only if necessary. Indexing a new column adds performance for queries but slows inserts and updates. Many teams add indexes by habit; resist it unless there's a measured need.