Adding a new column sounds trivial, but in production it can trigger schema locks, downtime, and failed deployments. The difference between a smooth migration and a breaking change is in how you design, deploy, and backfill that column.
A new column changes your database schema. In SQL, the basic syntax is:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This runs instantly on small tables. On large datasets, it can block reads and writes. PostgreSQL and MySQL handle new columns differently. PostgreSQL can add a nullable column without a full table rewrite if no default is specified. MySQL versions before 8.0 often require a copy of the table, which slows everything down.
Plan your new column by first defining its purpose, type, and constraints. Avoid defaults on huge tables unless required. If you need a default, set it after the column is added using an UPDATE statement in batches. Add indexes only after backfilling data. For high-traffic systems, run the migration in a maintenance window or use an online schema change tool like gh-ost or pt-online-schema-change.