The schema was tight. The deadline was tighter. You needed a new column and you needed it in production without downtime or mistakes.
Adding a new column in a live database is simple in theory, but in practice it carries risk. A poorly planned schema change can cause locks, break queries, or slow everything to a crawl. To do it right, you need a plan that works for both development and production environments.
First, define the purpose of the new column. Name it clearly and set the correct data type. Ambiguity here leads to errors downstream. Document this step so everyone who touches the code knows why it exists.
Second, decide how to handle existing data. If the new column is nullable, you can deploy it with minimal disruption. If it’s required, you must populate it in a way that doesn’t block reads and writes. Use background scripts or migration tools that support batched updates.