The product needed a new column, and the database schema had to change fast.
Adding a new column sounds simple. It is not. Schema migrations affect performance, cause downtime if done wrong, and can break production if not tested. Whether you work with PostgreSQL, MySQL, or distributed SQL systems, each engine handles column additions differently. The right approach depends on table size, index complexity, and replication strategy.
First, define the column name and type with precision. Avoid vague types; declare constraints early. If you need default values, evaluate whether to set them inline during creation or populate them asynchronously to avoid heavy locks. In PostgreSQL, ALTER TABLE ADD COLUMN is usually fast for metadata-only changes, but adding defaults can rewrite the table. In MySQL, adding columns to large tables in legacy versions can be blocking—use ALGORITHM=INPLACE when possible.