Plan a schema transition that survives rollback and re-upgrade.

Instruction: Give the read/write compatibility matrix, deployment gates and a safe rollback-to-re-upgrade sequence.

Context:

A fictional PostgreSQL service is renaming customer_name to display_name without changing its meaning. NULL is a legitimate name value. Version v0 reads and writes only customer_name. All application and batch writers are controlled by the team. Old and new instances overlap during deployment; product requires a two-week rollback window. The proposed migration immediately renames the column.

Design compatible version v1 and later new-only version v2. Trace this row: old=Maya, new=Maya after backfill; a rollback to v0 changes old to Mira while new remains Maya. Explain how a later upgrade returns Mira. Include a concurrent write during reconciliation and state who or what prevents an unsafe version from receiving traffic.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

I would add the new column and keep customer_name authoritative through the compatibility window. Version v1 writes both fields in one transaction and initially reads the old field...

Related Questions