-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Postgres driver doesn't respect configuration #262
Comments
This is fixed in master now and will go out with the next release. |
@dhui Great, thanks! |
fixed in v4.7.0 |
I think this issue is still persist |
This still doesn't work. If I create a new schema named "my_test_schema" and set:
The migration table and all the migrations will be created in the public schema. I think the issue is that in the sql files I'm not using the schema name prefixed to the table names and this is why it creates it in the public schema. I think a "SET SCHEMA " should be issued before running the migrations to make sure any sql that's read is appended on the correct schema. |
As per my comment above, further tested this, and I'm certain that is the problem. Currently I need to open a connection before the migration and execute |
That's what I'm doing right now, pass the But for MySQL there is no |
This is specifically for the Postgres driver. |
The issue is b/c the configured schema isn't used before migrations are run. The issue and fix involved is different from the original issue, so I've opened a new one. |
Describe the Bug
When opening a new connection to the database with
the method doesn't respect a given configuration but rather uses
SELECT CURRENT_DATABASE()
andSELECT CURRENT_SCHEMA()
instead.https://github.com/golang-migrate/migrate/blob/master/database/postgres/postgres.go#L52-L106
Steps to Reproduce
Expected Behavior
Expected migrate to create migrations table named
my_migrations
in schemamyschema
.Migrate Version
v4.5.0
Loaded Source Drivers
file
Loaded Database Drivers
postgres
Go Version
e.g. go version go1.11 linux/amd64
Obtained by running:
go version
Stacktrace
Please provide if available
Additional context
Due to security guidelines we're not allowed to use
pg_catalog
but have to use a different schema with dedicated users having access to the schema.The text was updated successfully, but these errors were encountered: