The table is ready, but the data is incomplete. You need a new column.
Adding a new column is one of the most common changes in any database. Done right, it’s simple. Done wrong, it can cause downtime, broken queries, and data loss. This guide shows how to create a new column with zero friction, while keeping schema changes clean and safe.
Plan before you add. Identify the type, constraints, and default values. A string, integer, boolean—choose what matches your data model. If the column is for critical data, add NOT NULL and a sensible default. Avoid sudden changes in live systems without migration steps.
Use migrations. In SQL, you can use:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This keeps your schema versioned when paired with tooling like Flyway, Liquibase, or built-in ORM migrations. For large tables, consider adding the column as nullable first, then backfilling data in batches before applying constraints to avoid locking.