Adding a new column should be simple, but in production it can break queries, stall deploys, and slow services. Done wrong, it locks tables, drops connections, or corrupts data. Done right, it ships fast without downtime.
First, define the new column in your migration script with clear data types and defaults. Use NULL defaults for safe, zero-impact additions on large datasets. For high-traffic databases, add the column in a non-blocking way using tools like pt-online-schema-change or built-in ALTER TABLE options that support ONLINE operations.
Second, plan for backward compatibility. Deploy code that can handle both old and new schemas before running the migration. Avoid writing to the column until reads are stable across all instances. This prevents failures when migrations take longer than expected.