mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:14:04 +00:00
Update to use version_compare
This commit is contained in:
parent
1b252935bb
commit
e74dea539c
1 changed files with 5 additions and 3 deletions
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||||
namespace Stancl\Tenancy\TenantDatabaseManagers;
|
namespace Stancl\Tenancy\TenantDatabaseManagers;
|
||||||
|
|
||||||
use Illuminate\Database\Connection;
|
use Illuminate\Database\Connection;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Stancl\Tenancy\Contracts\TenantDatabaseManager;
|
use Stancl\Tenancy\Contracts\TenantDatabaseManager;
|
||||||
use Stancl\Tenancy\Contracts\TenantWithDatabase;
|
use Stancl\Tenancy\Contracts\TenantWithDatabase;
|
||||||
|
|
@ -47,8 +46,11 @@ class PostgreSQLSchemaManager implements TenantDatabaseManager
|
||||||
|
|
||||||
public function makeConnectionConfig(array $baseConfig, string $databaseName): array
|
public function makeConnectionConfig(array $baseConfig, string $databaseName): array
|
||||||
{
|
{
|
||||||
Arr::has($baseConfig, 'search_path') ? $baseConfig['search_path'] = $databaseName : null;
|
if (version_compare(app()->version(), '9.0', '>=')) {
|
||||||
Arr::has($baseConfig, 'schema') ? $baseConfig['schema'] = $databaseName : null;
|
$baseConfig['search_path'] = $databaseName;
|
||||||
|
} else {
|
||||||
|
$baseConfig['schema'] = $databaseName;
|
||||||
|
}
|
||||||
|
|
||||||
return $baseConfig;
|
return $baseConfig;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue