mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 07:54:03 +00:00
Merge branch 'support-schema-postgres' of github.com:stancl/tenancy into support-schema-postgres
This commit is contained in:
commit
4041166f3a
3 changed files with 6 additions and 7 deletions
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||||
namespace Stancl\Tenancy;
|
namespace Stancl\Tenancy;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Exception;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Database\DatabaseManager as BaseDatabaseManager;
|
use Illuminate\Database\DatabaseManager as BaseDatabaseManager;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
|
|
@ -239,10 +238,10 @@ class DatabaseManager
|
||||||
|
|
||||||
return $this->app[$databaseManagers[$driver]];
|
return $this->app[$databaseManagers[$driver]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What key on the connection config should be used to separate tenants.
|
* What key on the connection config should be used to separate tenants.
|
||||||
*
|
*
|
||||||
* @param string $connectionName
|
* @param string $connectionName
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
@ -250,7 +249,7 @@ class DatabaseManager
|
||||||
{
|
{
|
||||||
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.separate_by'] === 'schema') {
|
||||||
return 'schema';
|
return 'schema';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'database';
|
return 'database';
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class DatabaseSchemaManagerTest extends TestCase
|
||||||
public function the_default_db_is_used_when_based_on_is_null()
|
public function the_default_db_is_used_when_based_on_is_null()
|
||||||
{
|
{
|
||||||
config(['database.default' => 'pgsql']);
|
config(['database.default' => 'pgsql']);
|
||||||
|
|
||||||
$this->assertSame('pgsql', config('database.default'));
|
$this->assertSame('pgsql', config('database.default'));
|
||||||
config([
|
config([
|
||||||
'database.connections.pgsql.foo' => 'bar',
|
'database.connections.pgsql.foo' => 'bar',
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ use Stancl\Tenancy\Jobs\QueuedTenantDatabaseDeleter;
|
||||||
use Stancl\Tenancy\Tenant;
|
use Stancl\Tenancy\Tenant;
|
||||||
use Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager;
|
use Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager;
|
||||||
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager;
|
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager;
|
||||||
use Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager;
|
|
||||||
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager;
|
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager;
|
||||||
|
use Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager;
|
||||||
|
|
||||||
class TenantDatabaseManagerTest extends TestCase
|
class TenantDatabaseManagerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
@ -79,7 +79,7 @@ class TenantDatabaseManagerTest extends TestCase
|
||||||
['mysql', MySQLDatabaseManager::class],
|
['mysql', MySQLDatabaseManager::class],
|
||||||
['sqlite', SQLiteDatabaseManager::class],
|
['sqlite', SQLiteDatabaseManager::class],
|
||||||
['pgsql', PostgreSQLDatabaseManager::class],
|
['pgsql', PostgreSQLDatabaseManager::class],
|
||||||
['pgsql', PostgreSQLSchemaManager::class]
|
['pgsql', PostgreSQLSchemaManager::class],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue