Skip to content

v0.5.0a9 — idempotent migration 013

Pre-release
Pre-release

Choose a tag to compare

@TheYonk TheYonk released this 04 Jun 13:46
· 56 commits to main since this release
bbe36ca

Patch release for the migration 013 idempotency fix (#67, #68).

Fixed

  • Migration 013_relationships_unique.sql re-runs cleanly instead of looping forever. ALTER TABLE ... ADD CONSTRAINT has no IF NOT EXISTS in Postgres, so re-applying 013 on a database where relationships_ns_edge_unique already existed — the constraint applied out-of-band, or its pgrg_applied_migrations row lost to a backup/restore taken between the schema change and the bookkeeping commit — raised 42710 duplicate_object. Because the migration runs in one transaction, that rolled it back and never recorded it, so every subsequent startup / pgrg migrate retried and failed again (the partial-migration-not-tracked loop). The constraint add is now wrapped in a pg_constraint existence guard, so the migration converges to the same end state on the first run and any repeat run. Steps 1-2 (dedup DML) were already idempotent. Adds test_migration_013_is_rerunnable.

Upgrade note: any database currently stuck in the 013 failure loop converges automatically on the next startup or pgrg migrate.