mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Merge pull request #6851 from appwrite/feat-sm-db
update projects database
This commit is contained in:
commit
bb46e3869c
2 changed files with 17 additions and 7 deletions
|
|
@ -92,15 +92,16 @@ App::post('/v1/projects')
|
||||||
|
|
||||||
$projectId = ($projectId == 'unique()') ? ID::unique() : $projectId;
|
$projectId = ($projectId == 'unique()') ? ID::unique() : $projectId;
|
||||||
|
|
||||||
$backups['database_db_fra1_v14x_02'] = ['from' => '03:00', 'to' => '04:00'];
|
$backups['database_db_fra1_v14x_02'] = ['from' => '03:00', 'to' => '05:00'];
|
||||||
$backups['database_db_fra1_v14x_03'] = ['from' => '00:00', 'to' => '01:00'];
|
$backups['database_db_fra1_v14x_03'] = ['from' => '00:00', 'to' => '02:00'];
|
||||||
$backups['database_db_fra1_v14x_04'] = ['from' => '00:00', 'to' => '01:00'];
|
$backups['database_db_fra1_v14x_04'] = ['from' => '00:00', 'to' => '02:00'];
|
||||||
$backups['database_db_fra1_v14x_05'] = ['from' => '00:00', 'to' => '01:00'];
|
$backups['database_db_fra1_v14x_05'] = ['from' => '00:00', 'to' => '02:00'];
|
||||||
$backups['database_db_fra1_v14x_06'] = ['from' => '00:00', 'to' => '01:00'];
|
$backups['database_db_fra1_v14x_06'] = ['from' => '00:00', 'to' => '02:00'];
|
||||||
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '01:00'];
|
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00'];
|
||||||
|
|
||||||
$databases = Config::getParam('pools-database', []);
|
$databases = Config::getParam('pools-database', []);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove databases from the list that are currently undergoing an backup
|
* Remove databases from the list that are currently undergoing an backup
|
||||||
*/
|
*/
|
||||||
|
|
@ -170,6 +171,15 @@ 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 ($index = array_search('database_db_fra1_self_hosted_0_0', $databases) && $project->getInternalId() % $mod === 0) {
|
||||||
|
$project->setAttribute('database', $databases[$index]);
|
||||||
|
$dbForConsole->updateDocument('projects', $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();
|
||||||
|
|
|
||||||
2
composer.lock
generated
2
composer.lock
generated
|
|
@ -5889,5 +5889,5 @@
|
||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "8.0"
|
"php": "8.0"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.2.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue