forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PostgresBuilder fixes for renamed `config('database.connections.pgsql…
….search_path')` 1. `PostgresBuilder::parseSchemaAndTable()` * Needs a fallback to <= 8.x `config('database.connections.pgsql.schema')` when 9.x renamed `config('database.connections.pgsql.search_path')` is missing. * Remove duplicate `$user` variable `config('database.connections.pgsql.username')` replacement handling already done by `parseSearchPath()`. 2. `PostgresBuilder::getAllTables()` + `getAllViews()` + `parseSchemaAndTable()` Apply the `parseSearchPath()` fixes applied to PostgresConnector: laravel#41088 3. `DatabasePostgresBuilderTest` Add more test cases and use terse method names instead of extensive comments to concisely communicate each case.
- Loading branch information
Showing
4 changed files
with
98 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Illuminate\Database\Concerns; | ||
|
||
trait ParsesSearchPath | ||
{ | ||
/** | ||
* Parse the "search_path" configuration value into an array. | ||
* | ||
* @param string|array|null $searchPath | ||
* @return array | ||
*/ | ||
protected function parseSearchPath($searchPath) | ||
{ | ||
if (is_string($searchPath)) { | ||
preg_match_all('/[^\s,"\']+/', $searchPath, $matches); | ||
|
||
$searchPath = $matches[0]; | ||
} | ||
|
||
$searchPath ??= []; | ||
|
||
array_walk($searchPath, static function (&$schema) { | ||
$schema = trim($schema, '\'"'); | ||
}); | ||
|
||
return $searchPath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters