-
Notifications
You must be signed in to change notification settings - Fork 17
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
Need a way to specify schema prefix for models #8
Comments
Hey @moredure Thanks for the suggestion. A quick question, can you elaborate on why this is needed? If your migrations are always in the scope of a specific schema, you should use a schema-bound connection to plan and apply them. (i.e connect to The resulting SQL files will not contain the schema qualifier, and are more flexible since they can be applied on more environments and not bound to a specific name. In any case, you can use the Does this make sense? |
I've tried ,--qualifier not works with gorm provider postgres on dev://postgres/latest/dbname, public schema specified then in migration files, but looks like it work when specifing search_path=public |
Can you share you atlas hcl file? Can you elaborate on why you need qualified table names? I'm interested in this use case because most of the time it's not needed |
pretty basic from the guide in atlas data "external_schema" "gorm" {
program = [
"go",
"run",
"-mod=mod",
"ariga.io/atlas-provider-gorm",
"load",
"--path", "./pathtomodels",
"--dialect", "postgres",
]
}
env "gorm" {
src = data.external_schema.gorm.url
dev = "docker://postgres/latest/dbname?search_path=public"
migration {
dir = "file://migrations_folder?format=golang-migrate"
}
} I need to apply migrations to specific schema but the files generated in migrations folder has "public" schema in them, trying to change it to schema I needed |
@rotemtam I had the same issue as @moredure and i think its specific to Postgres. When using Postgres, for some reason Atlas produces migrations with the "public" qualifier unless you specify search_path=public. Although the SQL this provider generates doesn't have the "public" qualifier so i think this is an issue with Atlas and not the provider. Recap ProblemWhen using Postgres, Atlas will generate migrations with the "public" qualifier, which breaks things if the target for the migrations isn't the public schema. SolutionDo what @rotemtam suggested and add
|
@rotemtam hi, please check #9
The text was updated successfully, but these errors were encountered: