The migration was complete, but the table still felt wrong. You needed a new column, and you needed it now.
Adding a new column is one of the most common schema changes in any production database. Done poorly, it locks tables, halts writes, and causes downtime. Done well, it rolls out in seconds without users noticing. The difference is in how you plan, execute, and test.
When creating a new column, start with a clear definition. Decide on the exact data type, constraints, and default values before touching the database. Avoid unnecessary NULL defaults if you always expect a value. This reduces storage overhead and keeps queries fast.
In SQL, the syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
In production, the real challenge is scale. Large tables may require online schema change tools like pt-online-schema-change for MySQL or built-in ALTER TABLE ... ADD COLUMN with ONLINE options in modern Postgres versions. These approaches keep locks minimal and avoid blocking requests.