Closed albulescu closed 3 weeks ago
Do you have any more information, which version of goose, which database, etc.?
E.g., using the latest version of goose and from the root of this repository:
$ make docker-postgres
...
postgres://dbuser:password1@localhost:5433/testdb?sslmode=disable
$ export GOOSE_DRIVER=pgx GOOSE_DBSTRING=postgres://dbuser:password1@localhost:5433/testdb?sslmode=disable
$ env | grep GOOSE_
GOOSE_DRIVER=pgx
GOOSE_DBSTRING=postgres://dbuser:password1@localhost:5433/testdb?sslmode=disable
$ goose -table _db_migrations -dir ./testdata/migrations up
2024/08/22 06:34:24 OK 00001_users_table.sql (4.98ms)
2024/08/22 06:34:24 OK 00002_posts_table.sql (5.61ms)
2024/08/22 06:34:24 OK 00003_comments_table.sql (8.42ms)
2024/08/22 06:34:24 OK 00004_insert_data.sql (4.15ms)
2024/08/22 06:34:24 OK 00005_posts_view.sql (7.13ms)
2024/08/22 06:34:24 goose: successfully migrated database to version: 5
Then confirming the tables:
SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname='public';
_db_migrations
users
posts
comments
It happens randomly even prior to v3.21.1 on osx.
Are you running things in parallel? That's the only scenario I can think of that would cause this, especially in tests.
Have same problem with Postgres on Debian:
2024/09/13 16:42:11 goose run: ERROR: relation "goose_db_version" already exists (SQLSTATE 42P07)
Goose version: 3.22.0
Postgres version: 13.8
I don't run anything in parallel.
if that would help someone - i was having same issue with supabase postgres, until changed mode
from transactional
to sussion
, after that all runs just fine
Running:
Output: