chore: update project creation database allocation
This commit is contained in:
parent
3caa49a547
commit
744f2fbc1c
|
@ -100,11 +100,6 @@ App::post('/v1/projects')
|
||||||
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00'];
|
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00'];
|
||||||
|
|
||||||
$databases = Config::getParam('pools-database', []);
|
$databases = Config::getParam('pools-database', []);
|
||||||
$databaseSelfHosted = 'database_db_fra1_self_hosted_0_0';
|
|
||||||
$selfHostedIndex = array_search($databaseSelfHosted, $databases);
|
|
||||||
if ($selfHostedIndex !== false) {
|
|
||||||
unset($databases[$selfHostedIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove databases from the list that are currently undergoing an backup
|
* Remove databases from the list that are currently undergoing an backup
|
||||||
|
@ -175,16 +170,6 @@ App::post('/v1/projects')
|
||||||
throw new Exception(Exception::PROJECT_ALREADY_EXISTS);
|
throw new Exception(Exception::PROJECT_ALREADY_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update database with self-managed db every $mod projects
|
|
||||||
*/
|
|
||||||
$mod = 20;
|
|
||||||
if ($project->getInternalId() % $mod === 0 && $selfHostedIndex !== false) {
|
|
||||||
$database = $databaseSelfHosted;
|
|
||||||
$project->setAttribute('database', $database);
|
|
||||||
$dbForConsole->updateDocument('projects', $project->getId(), $project);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dbForProject = new Database($pools->get($database)->pop()->getResource(), $cache);
|
$dbForProject = new Database($pools->get($database)->pop()->getResource(), $cache);
|
||||||
$dbForProject->setNamespace("_{$project->getInternalId()}");
|
$dbForProject->setNamespace("_{$project->getInternalId()}");
|
||||||
$dbForProject->create();
|
$dbForProject->create();
|
||||||
|
|
Loading…
Reference in a new issue