The database table was ready, but it was missing something—your new column.
Adding a new column is one of the most common schema changes, yet it can still break production if handled poorly. Whether you use PostgreSQL, MySQL, or SQL Server, the operation seems simple: ALTER TABLE ADD COLUMN. But you know the pitfalls—locking tables, blocking writes, mismatched defaults, migrations that stall under load. The difference between success and downtime is in the execution.
First, define the column with the right type and default. Avoid NULL when a non-null default protects queries from unexpected behavior. In PostgreSQL, adding a NOT NULL column with a default rewrites the entire table, which can be slow. Instead, add it as nullable, backfill values in batches, then apply the constraint.
Second, keep migrations idempotent. Schema changes should be safe to run twice, on staging or production, without conflict. Use feature flags in your application code so the new column is read after it’s written, not before. This shields active queries from missing data and keeps deploys smooth.