Postgresql: support schema "discovery" via search_path
See original GitHub issueCurrently
PostgresGenerator
always qualifies table names et al with a schema.- If the migration expression doesn’t explicitly specify a schema name via
.InSchema
,.WithSchema
, etc thenpublic
is used
This bypasses search_path
(eg when set in the Npgsql connection string) & so doesn’t allow schema to be set in config rather than code.
Support a configuration option, off by default, which when on affects handling of migration expressions without an explicit schema as follows:
- Existence tests in
PostgresProcessor
query all schemas insearch_path
- SQL generation in
PostgresGenerator
doesn’t qualify names with a schema
My use-case for this:
- I have 15 existing services using FluentMigrator & Postgres, with a database for each service
- I want to migrate the data into a single database with a schema for each service
- I’d like to do this by setting
search_path
for each service, avoiding per-service code changes
Issue Analytics
- State:
- Created 7 years ago
- Comments:24 (3 by maintainers)
Top Results From Across the Web
Documentation: 15: 5.9. Schemas
A PostgreSQL database cluster contains one or more named databases. ... The first schema named in the search path is called the current...
Read more >Demystifying Schemas & search_path through Examples
This guide shows how to use PostgreSQL schemas with multiple users ... knows what schema it is currently in based on the schema...
Read more >Failure to find table when using multiple schemas in ...
After much head scratching the answer became self-evident. First I had reset the search_path in the database. This did not help.
Read more >PostgreSQL Schema Search Path
To set a permanent search path for a database, use the “ALTER DATABASE” command followed by the “SET SEARCH_PATH” command: ALTER DATABASE ......
Read more >An Essential Guide to PostgreSQL Schema
In this tutorial, you will learn what a PostgreSQL schema is and how PostgreSQL uses the schema search path to resolve objects in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Instantiate a new convention set:
Append it to your services (after the
AddFluentMigratorCore
):@i-sinister I moved the above table and footnotes to: https://github.com/fluentmigrator/fluentmigrator/blob/master/adr/proposed/DefaultSchema.md