mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 09:54:05 +00:00
Make sure central connections aren't ever purged
This commit is contained in:
parent
c8a0a58df6
commit
93283d39ed
1 changed files with 4 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ class DatabaseManager
|
||||||
public function connect(Tenant $tenant)
|
public function connect(Tenant $tenant)
|
||||||
{
|
{
|
||||||
$this->createTenantConnection($tenant->getDatabaseName(), $tenant->getConnectionName());
|
$this->createTenantConnection($tenant->getDatabaseName(), $tenant->getConnectionName());
|
||||||
|
$this->setDefaultConnection($tenant->getConnectionName());
|
||||||
$this->switchConnection($tenant->getConnectionName());
|
$this->switchConnection($tenant->getConnectionName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,7 +50,10 @@ class DatabaseManager
|
||||||
*/
|
*/
|
||||||
public function reconnect()
|
public function reconnect()
|
||||||
{
|
{
|
||||||
|
// Opposite order to connect() because we don't
|
||||||
|
// want to ever purge the central connection
|
||||||
$this->switchConnection($this->originalDefaultConnectionName);
|
$this->switchConnection($this->originalDefaultConnectionName);
|
||||||
|
$this->setDefaultConnection($this->originalDefaultConnectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue