A rename looks like the safest migration there is. It is instant in Postgres. It still broke a deploy for me, because the old version of the app kept running for a few minutes and kept querying the old name.
The only approach I trust is expand and contract: add the new column, write to both, backfill in batches, switch reads, and drop the old column in a later release. It is slow, and it feels like a lot of ceremony for a name change.
Do you do the full sequence, or ship the rename in a maintenance window? And what do you do about ORMs that generate the rename for you?
Top comments (1)
The few minutes of old pods is the rolling update working as designed. A Deployment defaults to RollingUpdate with 25% maxSurge and 25% maxUnavailable, so old pods keep serving until the new ones are Ready. You can check yours with:
What keeps me on expand and contract is rollback. Ship the rename in one release, find a bug in the new code, roll the Deployment back, and the old code starts against the renamed column and fails the same way. Every expand and contract step before the drop can be rolled back.
If you'd rather use a window, setting strategy: Recreate for that release removes the overlap. You pay for it with downtime while the new pods start.