From ffa4645d253bf16a4b48d7459d7907797ba048de Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 10 Mar 2026 17:32:38 +0530 Subject: [PATCH] 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. --- app/init/resources.php | 4 ++-- app/worker.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index 9e09ef1ed2..5b989f781b 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -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) diff --git a/app/worker.php b/app/worker.php index e3a4385dd2..c143c83478 100644 --- a/app/worker.php +++ b/app/worker.php @@ -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', ''));