mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
The idx_relay_admin_outbox_pending index declared retry_after NULLS FIRST in both migration 0034 and schema.sql, but pgschema 1.7.4 (the real CI/test-relay bootstrap path) silently discards per-key NULLS FIRST when it re-emits the index, producing catalog indoption 0 0 while a fully-migrated database keeps 2 0. The desired-state bootstrap therefore diverged from the migration contract, and the prior parity regression missed it because it applied schema.sql via sqlx::raw_sql (which preserves NULLS FIRST) rather than through bin/pgschema. Drop NULLS FIRST from the index in both migration 0034 and schema.sql so both paths converge on plain-ascending (retry_after, created_at). The claim query's own ORDER BY retry_after NULLS FIRST, created_at ASC keeps the never-retried- first semantics; Postgres applies that ordering to the small pending candidate set regardless of the index's stored null ordering, and the partial predicate is what makes the index selective. Migrations 0032-0035 are branch-local and unshipped, so editing 0034 carries no checksum/brownfield risk. Rewrite the parity regression to bootstrap the desired state through the real bin/pgschema apply binary and assert per-key indoption (pg_index) alongside the rendered indexdef, so a construct pgschema cannot represent can no longer pass. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>