The migration was live, and the clock was red. One command stood between you and the feature launch: adding a new column.
A new column is simple in concept and dangerous in production. Schema changes can lock tables, block writes, or trigger costly downtime. Some ORMs hide the process in a helper method. Others leave you staring at raw SQL:
ALTER TABLE users ADD COLUMN last_active_at TIMESTAMPTZ;
On small datasets, this finishes fast. On large tables in production, it can cascade into timeouts. The execution plan matters. Database engines differ—PostgreSQL, MySQL, and SQLite each handle ADD COLUMN in their own way. Understanding storage layout, locks, and default values is critical before running the change.
Adding a nullable column is safer. Setting a default value forces a full table rewrite in many databases. Online schema change tools and background migrations can reduce risk. Postgres-specific approaches like ADD COLUMN ... DEFAULT ... with NOT NULL followed by ALTER commands in sequence can avoid downtime.