Skip to interview prep
Apexed

49. How do you rename a database column without downtime?

HardDebugging & production

Technical
Show model answer

Use expand and contract: add the new column; deploy code that writes to both columns; backfill existing rows in batches; switch reads to the new column; stop writing the old one; finally drop it in a later release. Each step is backward compatible, so you can roll back the application at any point.

How do you rename a database column without downtime — Software engineering interview question — Apexed