mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 07:54:03 +00:00
Merge pull request #2 from stancl/support-schema-postgres
Move separate_by to database
This commit is contained in:
commit
ac3751b24e
3 changed files with 3 additions and 3 deletions
|
|
@ -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.
|
'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',
|
'prefix' => 'tenant',
|
||||||
'suffix' => '',
|
'suffix' => '',
|
||||||
|
'separate_by' => 'database', // database or schema (only supported by pgsql)
|
||||||
],
|
],
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'prefix_base' => 'tenant',
|
'prefix_base' => 'tenant',
|
||||||
|
|
@ -69,7 +70,6 @@ return [
|
||||||
'mysql' => 'mysql',
|
'mysql' => 'mysql',
|
||||||
'pgsql' => 'pgsql',
|
'pgsql' => 'pgsql',
|
||||||
],
|
],
|
||||||
'separate_by' => 'database', // database or schema (only supported by pgsql)
|
|
||||||
'bootstrappers' => [
|
'bootstrappers' => [
|
||||||
// Tenancy bootstrappers are executed when tenancy is initialized.
|
// Tenancy bootstrappers are executed when tenancy is initialized.
|
||||||
// Their responsibility is making Laravel features tenant-aware.
|
// Their responsibility is making Laravel features tenant-aware.
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ class DatabaseManager
|
||||||
public function separateBy(string $connectionName): string
|
public function separateBy(string $connectionName): string
|
||||||
{
|
{
|
||||||
if ($this->getDriver($this->getBaseConnection($connectionName)) === 'pgsql'
|
if ($this->getDriver($this->getBaseConnection($connectionName)) === 'pgsql'
|
||||||
&& $this->app['config']['tenancy.separate_by'] === 'schema') {
|
&& $this->app['config']['tenancy.database.separate_by'] === 'schema') {
|
||||||
return 'schema';
|
return 'schema';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class DatabaseSchemaManagerTest extends TestCase
|
||||||
'database.connections.pgsql.schema' => 'public',
|
'database.connections.pgsql.schema' => 'public',
|
||||||
'tenancy.database.based_on' => null,
|
'tenancy.database.based_on' => null,
|
||||||
'tenancy.database.suffix' => '',
|
'tenancy.database.suffix' => '',
|
||||||
'tenancy.separate_by' => 'schema',
|
'tenancy.database.separate_by' => 'schema',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue