The migration was done, but the schema felt incomplete. A missing field. A blind spot. You open your editor and think about the one thing left to add: a new column.
Adding a new column sounds simple, but it can break more than it builds if done without care. The database is the source of truth. A single change touches queries, indexes, and application logic. The goal is to create the column with zero downtime, no data loss, and a plan for rollback.
First, define the exact purpose of the new column. Decide on its type, default value, and whether it can be null. This step is not cosmetic—choosing wrong will haunt every query.
Next, understand the load on your database before altering the table. Large tables lock when you run an ALTER TABLE in most systems. In MySQL and PostgreSQL, check if your version supports concurrent or online DDL. If not, run the operation in off-peak hours or use tools like pt-online-schema-change.