1
0
Fork 0
mirror of synced 2024-10-02 02:07:04 +13:00

Merge pull request #7045 from appwrite/update-project-creation-logic

chore: update project creation database allocation
This commit is contained in:
Christy Jacob 2023-10-30 19:34:21 +04:00 committed by GitHub
commit 0a6ee966a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,11 +100,6 @@ App::post('/v1/projects')
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00'];
$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
@ -175,16 +170,6 @@ App::post('/v1/projects')
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->setNamespace("_{$project->getInternalId()}");
$dbForProject->create();