Adding a new column is one of the most common operations in database management. It changes the shape of your data and the structure of your application. Done right, it is quick and safe. Done wrong, it can block queries, break code, and corrupt production.
Before you create a new column, define its purpose. Know the exact type: integer, text, boolean, timestamp. Set default values that make sense. Decide whether it can be null or must be required. Think about indexing—it can speed lookups but slow inserts.
Use migrations to add the column in a controlled way. In SQL, the command is straightforward:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
In distributed systems, this change is more complex. Deploy code that understands both the old schema and the new schema. Roll out the column in phases: add it, start writing to it, then start reading from it. This avoids downtime and race conditions.