Revert "Fix usage on DB Pools"

This commit is contained in:
Christy Jacob
2022-10-26 21:32:40 +05:30
committed by GitHub
parent 95b6d5d428
commit c2be54ca7f
6 changed files with 126 additions and 156 deletions
-24
View File
@@ -12,7 +12,6 @@ use Utopia\Config\Config;
use Utopia\Database\Database;
use Utopia\Database\Validator\Authorization;
use InfluxDB\Database as InfluxDatabase;
use Utopia\Database\Document;
function getInfluxDB(): InfluxDatabase
{
@@ -60,29 +59,6 @@ function getConsoleDB(): Database
return $database;
}
function getProjectDB(Document $project): Database
{
global $register;
$pools = $register->get('pools'); /** @var \Utopia\Pools\Group $pools */
if ($project->isEmpty() || $project->getId() === 'console') {
return getConsoleDB();
}
$dbAdapter = $pools
->get($project->getAttribute('database'))
->pop()
->getResource()
;
$database = new Database($dbAdapter, getCache());
$database->setNamespace('_' . $project->getInternalId());
return $database;
}
function getCache(): Cache
{
global $register;