Migration chain is not reproducible on a fresh database (0505 references an org no migration creates) #2

Closed
opened 2026-07-09 21:45:51 -03:00 by navigator · 0 comments
Owner

cargo sqlx migrate run on a fresh database fails at migration 0505:

error: while executing migration 505: insert or update on table "election" violates foreign key constraint "election_org_id_fkey"

The default org 11111111-1111-1111-1111-111111111111 was created by hand on dev/prod, so the chain only works on databases that inherited that row. This blocked the CI test and coverage jobs (and any new developer machine), and every migration after 0505 (incl. citizen.suspended_at from 0507) never applied — cascading into dsoc-auth integration-test failures.

Fix in PR: 0505 now seeds the org idempotently (ON CONFLICT (id) DO NOTHING). Safe everywhere: prod/dev already have the row; sqlx checksums unaffected (prod untracked, dev tracked only ≤ 0390, CI had not recorded 0505).

`cargo sqlx migrate run` on a fresh database fails at migration 0505: ``` error: while executing migration 505: insert or update on table "election" violates foreign key constraint "election_org_id_fkey" ``` The default org `11111111-1111-1111-1111-111111111111` was created by hand on dev/prod, so the chain only works on databases that inherited that row. This blocked the CI `test` and `coverage` jobs (and any new developer machine), and every migration after 0505 (incl. `citizen.suspended_at` from 0507) never applied — cascading into `dsoc-auth` integration-test failures. Fix in PR: 0505 now seeds the org idempotently (`ON CONFLICT (id) DO NOTHING`). Safe everywhere: prod/dev already have the row; sqlx checksums unaffected (prod untracked, dev tracked only ≤ 0390, CI had not recorded 0505).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
brasil/democracia-social#2
No description provided.