The migration failed because the new column was missing. Everyone stared at the logs. No one moved.
Adding a new column should be simple. In SQL, you define the schema change, run the migration, and verify. In production systems, the details decide if it works or breaks. Databases under load respond differently. Large tables make column additions expensive, so locking strategies and online tools matter.
A new column can be appended with:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This works in PostgreSQL, MySQL, and most relational systems. But adding defaults triggers data rewrites, which can increase migration time from seconds to hours. To avoid downtime, apply the column with NULL allowed, backfill in batches, then set constraints. This keeps transactions fast and limits locks.
Indexing a new column requires attention. Adding an index during peak load can block writes. Use concurrent indexing in PostgreSQL or non-blocking index creation in MySQL where possible. Always measure the impact in a staging environment with realistic data.