Adding a new column sounds simple. It’s not, if uptime matters. Schema changes can lock tables, halt writes, and tank latency. The right approach is knowing how your database engine handles ALTER TABLE and planning for zero-downtime changes.
First, define the column with the correct data type and constraints from the start. Avoid nullable columns unless they serve a clear purpose; they often hide bad data models. Make sure the default value fits production reality—changing it later can be expensive.
Second, test the migration path. For PostgreSQL or MySQL, adding a column without a default value can be fast. Adding one with a default for every row can trigger a full table rewrite. This can block queries and stall services. Use migrations that break large changes into smaller, deployable steps.