Skip to content

Goose returns incorrect error when multiple DB users try to up migrations #800

@R0masik

Description

@R0masik

I have Postgres and 2 users in it (user1 and user2) with all granted rights. I run migrations as user1 and it completed successfully, then I try to run the same migrations from user2, but I get error relation "goose_db_version" already exists, although the real error is that permission to read "goose_db_version" table is denied for user2.

The problem is in the line https://github.com/pressly/goose/blob/master/migrate.go#L216, goose tries to get list of migrations and after getting any error tries to create table "goose_db_version". This is confusing, I think it is necessary to create table "goose_db_version" only if it does not exist and return error in any other case.

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