Skip to content

fix(db): make migration 000027 idempotent (savings_snapshots_pk) #246

Description

@cristim

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions