Refactor database adapter initialization for attribute support

- Moved the `setSupportForAttributes` method call from the adapter initialization to the database resource creation in `getDatabasesDB`.
- Updated the logic to ensure attribute support is set correctly based on the database type.
This commit is contained in:
ArnabChatterjee20k
2026-03-10 17:32:38 +05:30
parent ca0656ce35
commit ffa4645d25
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -874,7 +874,6 @@ Http::setResource('getDatabasesDB', function (Group $pools, Cache $cache, Docume
$pool = $pools->get($databaseDSN->getHost());
$adapter = new DatabasePool($pool);
$adapter->setSupportForAttributes($databaseType !== DOCUMENTSDB);
$database = new Database($adapter, $cache);
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
@@ -885,7 +884,8 @@ Http::setResource('getDatabasesDB', function (Group $pools, Cache $cache, Docume
->setMetadata('project', $project->getId())
->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_API)
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES);
// inside pools authorization needs to be set first
$database->getAdapter()->setSupportForAttributes($databaseType !== DOCUMENTSDB);
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
+1 -1
View File
@@ -247,11 +247,11 @@ Server::setResource('getDatabasesDB', function (Cache $cache, Registry $register
$pool = $pools->get($databaseDSN->getHost());
$adapter = new DatabasePool($pool);
$adapter->setSupportForAttributes($databaseType !== DOCUMENTSDB);
$database = new Database($adapter, $cache);
$database
->setDatabase(APP_DATABASE)
->setAuthorization($authorization);
$database->getAdapter()->setSupportForAttributes($databaseType !== DOCUMENTSDB);
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));