-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Postgres broken? #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What version of migrate are you using? The postgres driver should create the Did you have any successful up or down migrations run? Did you delete any migrations in between the runs? |
Version 3.4.0 installing into the postgres:9.6 image from docker hub. Database was already created. I finally got it running, seems to be some kind of issue with roles? I don't have any explicit changes of role in the migrations but the ownership of various tables (not |
Ahh, yeah, the pg user/role needs the |
They need |
Oh, no, I misspoke. The pg user/role doesn't need |
When i try to run migrate from upstream master i run into the following problem: ```bash kj@vrrr:~/repos/migrate-upstream/cli/build> ./migrate.linux-amd64 -source file:///home/kj/work/cncenter.git/behav-api/sql/ -database postgres://postgres:[email protected]:5432/?sslmode=disable -verbose up 1 2019/01/31 18:35:11 Start buffering 1/u initialize_db 2019/01/31 18:35:12 Read and execute 1/u initialize_db 2019/01/31 18:35:12 error: pq: relation "schema_migrations" does not exist in line 0: TRUNCATE "schema_migrations" ``` Postres is complaining: ``` 2019-01-31 17:35:12.440 UTC [61] ERROR: relation "schema_migrations" does not exist 2019-01-31 17:35:12.440 UTC [61] STATEMENT: TRUNCATE "schema_migrations" ``` I am running postgres like this: `docker run --rm --net=behavnet --name postgres -p 5432:5432 -v /home/kj/temp:/tmp:rw postgres:10.6` I found an old closed issue golang-migrate#93 which suggested that i might need priviliges: ```bash postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} ``` Other than that, there was no other suggestion or resolution of that issue. With this commit built, i have no more problems: ```bash kj@vrrr:~/repos/migrate/cli/build> ./migrate.linux-amd64 -source file:///home/kj/work/cncenter.git/behav-api/sql/ -database postgres://postgres:[email protected]:5432/?sslmode=disable -verbose up 1 2019/01/31 18:42:06 Start buffering 1/u initialize_db 2019/01/31 18:42:06 Read and execute 1/u initialize_db 2019/01/31 18:42:06 Finished 1/u initialize_db (read 12.662008ms, ran 155.706703ms) 2019/01/31 18:42:06 Finished after 169.958723ms 2019/01/31 18:42:06 Closing source and database ``` No more errors in postgres log.
I may be missing something but I'm trying to run a single migration against an empty postgres database and I get the following behaviour:
In the first instance I would have expected migrate to create the
schema_migrations
table and I see code to do that. I saw another closed issue with the same error and it was suggested thesearch_path
should be set. I tried this and still get the exact same behaviour as above.Also worth noting, after running the command the first time the database appears to be empty. Only the public schema exists and it has no tables in it. After running the same command again, most but not all of the tables are created and as you can see, there's no useful error on which specific query in the migration failed.
The text was updated successfully, but these errors were encountered: