Skip to content
This repository was archived by the owner on Feb 14, 2020. It is now read-only.
This repository was archived by the owner on Feb 14, 2020. It is now read-only.

Duplicate key migration error - timestamp should not be primary key #6

@simontabor

Description

@simontabor

When trying to apply migrations (using default config of pending: true, method: 'all') and there's more than one migration pending, I'm getting a duplicate key error...

duplicate key value violates unique constraint "migrations_pkey" (coming from https://github.com/programble/careen/blob/master/lib/runner.ts#L74)

The schema for the migrations table needs changing - timestamps should never be used as a primary key like this. Whilst in all mode, it's trying to insert multiple rows with the exact same ID.

timestamp can be an indexed column, but not unique. Alternatively a new column of id could be added as a serial primary key, but that seems unnecessary.

Changing the method to each works around the problem for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions