Adding a new column in production is more than a syntax change. It requires precision, awareness of constraints, and control over how data flows during the update. The wrong move can lock tables, slow queries, or cause downtime that echoes across the stack.
Start with a clear definition of the field name, type, and default value. In SQL, the command is direct:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
But in real systems, adding a new column is rarely the last step. You must account for migrations, code references, and how the application layer reads and writes to it. Deploy the schema migration separately from the application change to reduce risk. If indexes are needed, create them after the data backfill rather than during the add column step to avoid long locks.