From 8699c8530bc8f60d69b3b374bb4b88dde4f16c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 9 Dec 2019 14:43:42 +0100 Subject: [PATCH] Move separate_by to database --- assets/config.php | 2 +- src/DatabaseManager.php | 2 +- tests/DatabaseSchemaManagerTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/config.php b/assets/config.php index 42798b19..5e285da3 100644 --- a/assets/config.php +++ b/assets/config.php @@ -30,6 +30,7 @@ return [ 'based_on' => null, // The connection that will be used as a base for the dynamically created tenant connection. Set to null to use the default connection. 'prefix' => 'tenant', 'suffix' => '', + 'separate_by' => 'database', // database or schema (only supported by pgsql) ], 'redis' => [ 'prefix_base' => 'tenant', @@ -69,7 +70,6 @@ return [ 'mysql' => 'mysql', 'pgsql' => 'pgsql', ], - 'separate_by' => 'database', // database or schema (only supported by pgsql) 'bootstrappers' => [ // Tenancy bootstrappers are executed when tenancy is initialized. // Their responsibility is making Laravel features tenant-aware. diff --git a/src/DatabaseManager.php b/src/DatabaseManager.php index 0dd6c317..05a8d9e3 100644 --- a/src/DatabaseManager.php +++ b/src/DatabaseManager.php @@ -248,7 +248,7 @@ class DatabaseManager public function separateBy(string $connectionName): string { if ($this->getDriver($this->getBaseConnection($connectionName)) === 'pgsql' - && $this->app['config']['tenancy.separate_by'] === 'schema') { + && $this->app['config']['tenancy.database.separate_by'] === 'schema') { return 'schema'; } diff --git a/tests/DatabaseSchemaManagerTest.php b/tests/DatabaseSchemaManagerTest.php index 65c011c0..aaaa0b91 100644 --- a/tests/DatabaseSchemaManagerTest.php +++ b/tests/DatabaseSchemaManagerTest.php @@ -20,7 +20,7 @@ class DatabaseSchemaManagerTest extends TestCase 'database.connections.pgsql.schema' => 'public', 'tenancy.database.based_on' => null, 'tenancy.database.suffix' => '', - 'tenancy.separate_by' => 'schema', + 'tenancy.database.separate_by' => 'schema', ]); }