Databases · Middle · Question 39 of 75
What is a safe way to rename a column used by a running application?
- 1Rename it and restart all servers at the same time
- 2Rename it in one migration during deploy
- ✓Correct answer: Expand and contract: add the new column, write to both, backfill, switch reads, then drop the old column in a later release
Explanation
During a rolling deploy old and new code run together, so every schema change must work with both versions.