-
Notifications
You must be signed in to change notification settings - Fork 277
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
Separating schema_migration
from the search_path
#429
Comments
@DevopsMercenary Can you include the migration SQL file that you're using in your test that is creating objects in the There are postgres driver tests that cover the custom schema functionality you're referring to. If your migration files themselves do not explicitly specify a schema, then according to the PostgreSQL documentation on schemas it says:
Can you see what the output of c.f. https://dba.stackexchange.com/questions/56023/what-is-the-search-path-for-a-given-database-and-user for more about setting database and user role level |
What exact commands are you running? Can you try creating the DB yourself first without using dbmate? |
@DevopsMercenary Take a look at the comment I just added to #440. I suspect it's related to what you're seeing, as well. I'll work on coming up with a reproducible test that better exercises multiple schemas and being able to have the schema migrations table live in one schema, while having the migrations themselves apply in the session's default schema. Just wanted to update this issue, for those who are still tracking it. |
Faced the same issue as described by @DevopsMercenary I mitigated by adding Here's how a simple create table migration looked like: -- migrate:up
create table if not exists public.employees (
id uuid primary key not null,
name text
);
-- migrate:down
drop table if exists public.employees; Upon running |
Description
I have a security situation where I can not allow the
schema_migration
table to be located in the same schema that my tables and such are located in.I've tried a couple of different ways to do this ( have the
schema_migration
in its own schema )My first method was to specify the
DBMATE_MIGRATIONS_TABLE
by prepending the schema name.file:
.env
In this case I expected the
schema_migration
table be in a newdbmate
schema AND it is.I expected my tables to be created in the
test_schema
BUT my new tables are in thedbmate
schemaTrying a second method, i see in the documentation that.
I assumed then if the first schema is for the
schema_migrations
table then the second would be used for my objects like tables etc.My
.env
I tried the followingBut again everything is created in the
dbmate
schema.I think dbmate is working as designed and the issue is that I'm trying to something that is not supported. A
schema_migrations
schema name variable would be nice to be able to explicitly put and use theschema_migrations
table in another schema and not effect the search_path.Steps To Reproduce
Expected Behavior
The text was updated successfully, but these errors were encountered: