A new column in a database is simple in theory. In practice, it can break everything if you get it wrong. Adding a column changes structure, impacts queries, and ripples through APIs, deployments, and analytics. The key is to control the blast radius.
In SQL, the basic syntax is straightforward:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But production systems demand more. You must check for existing indexes, update ORM models, migrate historical data if required, and validate downstream services. Schema migrations should be idempotent and safe across environments.
When deploying, use feature flags to roll out the new column. Backfill in controlled batches to avoid locking large tables. For large-scale systems, partition migrations or use tools like pt-online-schema-change to avoid downtime.