Integration tests that spin up a fresh Postgres via testcontainers-go can't run the full migration set — migration 000027 (savings_snapshots_pk) tries to ADD PRIMARY KEY that migration 000018 already added, failing with 'multiple primary keys for table'.
Production DBs aren't affected because they were already in the 'duplicate rows needing dedup' state that 000027 was written to fix.
Fix: make the ADD CONSTRAINT idempotent (e.g. DROP CONSTRAINT IF EXISTS first, or wrap in a conditional PL/pgSQL block) without changing the behaviour on already-migrated databases.
Commit 2d8f1e2 currently works around it by bypassing migrations entirely for the cache integration test.
Integration tests that spin up a fresh Postgres via testcontainers-go can't run the full migration set — migration 000027 (savings_snapshots_pk) tries to ADD PRIMARY KEY that migration 000018 already added, failing with 'multiple primary keys for table'.
Production DBs aren't affected because they were already in the 'duplicate rows needing dedup' state that 000027 was written to fix.
Fix: make the ADD CONSTRAINT idempotent (e.g. DROP CONSTRAINT IF EXISTS first, or wrap in a conditional PL/pgSQL block) without changing the behaviour on already-migrated databases.
Commit 2d8f1e2 currently works around it by bypassing migrations entirely for the cache integration test.