Adding a new column sounds simple until it breaks the wrong query in the wrong service. The key is to add it safely, without blocking writes, losing data, or causing downtime. Whether the backend runs on PostgreSQL, MySQL, or a cloud-managed database, the process follows the same core steps: plan, deploy, backfill, and switch over.
Start with a clear migration plan. Define the column name, type, default value, and whether it can be null. Avoid renaming or dropping existing columns as part of the same change; isolate the new column to make rollback easier.
Deploy the schema change in a non-blocking way. In PostgreSQL, use ALTER TABLE ... ADD COLUMN with a default set in the application layer instead of the DDL when possible. This avoids table rewrites that lock writes. In MySQL, ensure ALGORITHM=INPLACE is supported, or run it online with a tool like pt-online-schema-change. Test on staging or a production clone to measure lock time.