1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 11:44:04 +00:00

Merge branch 'support-schema-postgres' of github.com:stancl/tenancy into support-schema-postgres

This commit is contained in:
Samuel Štancl 2019-12-02 20:41:44 +01:00
commit 4041166f3a
3 changed files with 6 additions and 7 deletions

View file

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Stancl\Tenancy;
use Closure;
use Exception;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\DatabaseManager as BaseDatabaseManager;
use Illuminate\Foundation\Application;
@ -239,10 +238,10 @@ class DatabaseManager
return $this->app[$databaseManagers[$driver]];
}
/**
* What key on the connection config should be used to separate tenants.
*
*
* @param string $connectionName
* @return string
*/
@ -250,7 +249,7 @@ class DatabaseManager
{
if ($this->getDriver($this->getBaseConnection($connectionName)) === 'pgsql'
&& $this->app['config']['tenancy.separate_by'] === 'schema') {
return 'schema';
return 'schema';
}
return 'database';

View file

@ -42,7 +42,7 @@ class DatabaseSchemaManagerTest extends TestCase
public function the_default_db_is_used_when_based_on_is_null()
{
config(['database.default' => 'pgsql']);
$this->assertSame('pgsql', config('database.default'));
config([
'database.connections.pgsql.foo' => 'bar',

View file

@ -10,8 +10,8 @@ use Stancl\Tenancy\Jobs\QueuedTenantDatabaseDeleter;
use Stancl\Tenancy\Tenant;
use Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager;
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager;
use Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager;
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLSchemaManager;
use Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager;
class TenantDatabaseManagerTest extends TestCase
{
@ -79,7 +79,7 @@ class TenantDatabaseManagerTest extends TestCase
['mysql', MySQLDatabaseManager::class],
['sqlite', SQLiteDatabaseManager::class],
['pgsql', PostgreSQLDatabaseManager::class],
['pgsql', PostgreSQLSchemaManager::class]
['pgsql', PostgreSQLSchemaManager::class],
];
}