[9.x] Replace schema with search_path in pgsql config #5726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per laravel/framework#35588 , the term "schema" (a namespace) has been corrected to "search_path" (a list of namespaces), where appropriate, throughout the framework.
Accordingly, the
schema
configuration key should be changed tosearch_path
to better reflect the fact that it may specify a list of schemata (schemas), and not just a single schema. (In several Laravel versions prior to 9.0, theschema
key could already specify more than one schema, but this fact was undocumented and non-obvious without examining the implementation carefully.)As of Laravel 9.0, the
search_path
may specify any number of schemata, in any of the following formats:'search_path' => 'public',
'search_path' => 'public,laravel',
'search_path' => ['public', '"laravel"', "'foobar'", '$bat'],
'search_path' => ''public', "laravel", "'foobar'", '$bat'',
'search_path' => '"$user", public',
Note that in the last example, the
$user
variable refers to PostgreSQL's special $user variable, as described in the Schema Documentation ( https://www.postgresql.org/docs/current/ddl-schemas.html ).Note also that Laravel's default
search_path
value, 'public', is not necessarily the best choice for every use case. Developers should consult the "Usage Patterns" section of the aforementioned documentation before deciding how best to set thesearch_path
, as it has security implications.