The schema is changing. You need a new column.
Adding a new column in a production database is never just a syntax detail—it’s a decision with downstream effects on queries, indexes, and application logic. Whether you’re working with PostgreSQL, MySQL, SQL Server, or a managed cloud database, the fundamentals remain the same: understand the data type, default values, and nullability before you write a single command.
In SQL, the operation looks simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
But simplicity on paper hides the real work. On large tables, ALTER TABLE can trigger locks, block writes, or cause replication lag. This makes planning essential. Add the column in a maintenance window or use tools that apply schema changes online.
Performance should be top of mind. Adding a column with a default value can rewrite the entire table in some engines. Consider making the column nullable first, backfilling data in small batches, and then adding constraints once data is in place.