PostgreSQL Committed Migration 2: Why Did the Go Runner Report Zero?
Two deployments each reported zero newly confirmed migrations. On the promoted PostgreSQL standby, one schema already contained migration 2. The other still needed it. If our deployment agent retried the same SQL whenever it saw zero, it would write a duplicate in the first schema.
I started go-migrate in 2023 as the migration layer of a private Go framework. Like its structured logging layer, it now ships independently. A broken connection during COMMIT gave us a concrete way to test what a deployer can safely infer from the runner’s return value. HaloLog
Make a duplicate observable.
We seeded two schemas at version 1. In each, version 2 inserts the integer 2 into an ordinary table. We deliberately left the column without a uniqueness constraint. An accidental replay could succeed, leaving two copies of 2 and a green deployment. The test therefore reads the application rows as well as the migration...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE