The database waited, silent, until you told it to change. You needed a new column. The schema had to grow, but the system could not stop.
Adding a new column to a production database is not just a line in a migration file. It is a decision that will ripple through data models, APIs, and services. Schema changes can block queries, trigger locks, and cause downtime if handled without care.
The safest way to add a new column starts with understanding the database engine’s behavior. In PostgreSQL, adding a nullable column with a default value is different than adding one without a default. One path rewrites the entire table, slowing performance. The other avoids rewrites and completes fast. MySQL and SQLite handle these operations differently, with their own quirks and cost profiles.
Always create a new column in a non-blocking way. Keep the default null in the schema change. Backfill data in small batches, then set the default. If the column will be required, enforce constraints only after all records are updated. These steps reduce risk and keep your application responsive.