Skip to content
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: Support custom schema for schema_migrations table #167

Merged
merged 5 commits into from Nov 1, 2020

Conversation

amacneil
Copy link
Owner

@amacneil amacneil commented Oct 31, 2020

Instead of hardcoding schema_migrations table to the public schema, add support for specifying a schema via the search_path URL parameter.

Backwards compatibility note: If anyone was using the previously undocumented search_path behavior (affecting migrations themselves, but always storing the schema_migrations table in public), you will need to either prepend public to your search_path, or migrate your schema_migrations table to your primary schema:

ALTER TABLE public.schema_migrations SET SCHEMA myschema;

cc @RabidFire

Closes #110

@amacneil amacneil changed the title postgres: support postgres: support custom schema for schema_migrations table Oct 31, 2020
@amacneil amacneil changed the title postgres: support custom schema for schema_migrations table postgres: Support custom schema for schema_migrations table Oct 31, 2020
@amacneil amacneil force-pushed the auto-schema branch 3 times, most recently from 9b81b38 to f577e82 Compare October 31, 2020 22:37
@amacneil amacneil merged commit 55a8065 into master Nov 1, 2020
@amacneil amacneil deleted the auto-schema branch November 1, 2020 00:30
amacneil added a commit that referenced this pull request Nov 1, 2020
In #167 we added support for specifying a postgres `search_path`, which is used to store the `schema_migrations` table. However, if the schema does not already exist it will cause an error.

In this PR we automatically create the first schema in the `search_path` if it does not exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PostrgeSQL schema setting for migrations table
1 participant