The migration was done, but the schema felt wrong. The table needed a new column—fast, clean, and without breaking production.
Adding a new column is routine, but the risks hide in the edges: locked tables, broken queries, poor defaults. The problem isn’t syntax. Anyone can type ALTER TABLE. The problem is applying it with precision under load.
Start with the target table. Map every dependency. Check if the column will be nullable, defaulted, indexed, or contain unique constraints. Every choice affects performance. An empty column on a large table can still trigger a full rewrite depending on the database engine.
For PostgreSQL, adding a nullable column without a default is instant for most workloads. Adding a column with a default can block if not done with ALTER TABLE ... ADD COLUMN ... DEFAULT ... USING ... in a safe way. MySQL’s behavior depends on storage engine; InnoDB rewrites more aggressively. Document exactly what happens before hitting enter.