1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:54:03 +00:00

Create MySQL/PostgreSQL DBs while using sqlite as the central DB driver

This commit is contained in:
Samuel Štancl 2019-09-21 11:11:36 +02:00
parent 1e6b21cfd4
commit eb6cba8f1a
11 changed files with 62 additions and 22 deletions

View file

@ -61,6 +61,7 @@ class DatabaseManager
*/
public function createTenantConnection($databaseName, $connectionName)
{
// todo2 if $connectionName is custom, it should be used instead of based_on
// Create the database connection.
$based_on = $this->app['config']['tenancy.database.based_on'] ?? $this->originalDefaultConnectionName;
$this->app['config']["database.connections.$connectionName"] = $this->app['config']['database.connections.' . $based_on];
@ -123,7 +124,7 @@ class DatabaseManager
if ($this->app['config']['tenancy.queue_database_creation'] ?? false) {
QueuedTenantDatabaseCreator::dispatch($manager, $database);
} else {
return $manager->createDatabase($database);
$manager->createDatabase($database);
}
}
@ -141,7 +142,7 @@ class DatabaseManager
if ($this->app['config']['tenancy.queue_database_deletion'] ?? false) {
QueuedTenantDatabaseDeleter::dispatch($manager, $database);
} else {
return $manager->deleteDatabase($database);
$manager->deleteDatabase($database);
}
}