The query was fast, but the table was wrong. A missing field, an overlooked ALTER TABLE, and now deployment was blocked. You need a new column. Not tomorrow, not next sprint—now.
Adding a new column is simple in theory: define it, set its type, and update the schema. In production, it becomes a matter of performance, locking, and data integrity. The goal is zero downtime, minimal risk, and complete traceability.
Start with schema control. Use explicit migrations in version control rather than manual database changes. For SQL databases like Postgres or MySQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
Run the migration inside a transaction if supported. For large datasets, adding a column with a default value can cause table rewrites and locks. Mitigate this by adding the column as nullable, backfilling in batches, and then adding constraints after.