Menu

Two migrations collide: one loud failure, one silent one
πŸ“°

Two migrations collide: one loud failure, one silent one

DEV Community: postgresΒ·EggletricΒ·2 days ago
#np3tNzlO
#devtopostgresql#devto#dev#migration#index
Reading 0:00
15s threshold

In the previous post I argued that migrations don't earn Git's protections by being made of files: two incompatible schema changes live in two separate migration files, so there is nothing to textually conflict, and both branches merge clean. The repository accepts the pair without comment.

That post ended with a claim: the collision is not resolved in the repo, so it must be resolved somewhere else β€” at apply time, per environment, inside the database. This post is that claim, run for real. What actually happens when the pair lands?

I ran the collisions on PostgreSQL 16 to find out. The answer comes in two flavors β€” one loud, one silent β€” and the silent one is worse.

None of what follows is an argument against migrations, or against the defensive idioms people write in them. Every tool below does exactly what it promises. The point is what those promises do and don't cover once two branches meet.

The loud collision: order decides which environment breaks

Branch A adds a column to users .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.