question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Postgresql: support schema "discovery" via search_path

See original GitHub issue

Currently

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 in search_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:closed
  • Created 7 years ago
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
fubar-codercommented, Jan 25, 2019

Instantiate a new convention set:

var conventionSet = new DefaultConventionSet(defaultSchemaName, null);

Append it to your services (after the AddFluentMigratorCore):

services.AddSingleton<IConventionSet>(conventionSet);
0reactions
jzabroskicommented, Sep 1, 2020
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found