Update composer dependencies and refactor tenant handling in database connections

- Updated the version of "utopia-php/database" to 5.3.15 in composer.json and composer.lock.
- Removed the repository entry for "utopia-php/database" from composer.json.
- Refactored tenant handling in multiple files to cast project sequence to an integer for consistency.
This commit is contained in:
ArnabChatterjee20k
2026-03-18 18:36:47 +05:30
parent 12d274a72c
commit ea9fb5ff36
7 changed files with 31 additions and 76 deletions
+4 -4
View File
@@ -167,7 +167,7 @@ $setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $c
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -188,7 +188,7 @@ $setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $c
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -212,7 +212,7 @@ $setResource('getLogsDB', function (Group $pools, Cache $cache, Authorization $a
return function (?Document $project = null) use ($pools, $cache, $database, $authorization) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getSequence());
$database->setTenant((int) $project->getSequence());
return $database;
}
@@ -229,7 +229,7 @@ $setResource('getLogsDB', function (Group $pools, Cache $cache, Authorization $a
// set tenant
if ($project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getSequence());
$database->setTenant((int) $project->getSequence());
}
return $database;
+4 -4
View File
@@ -589,7 +589,7 @@ Http::setResource('dbForProject', function (Group $pools, Database $dbForPlatfor
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -848,7 +848,7 @@ Http::setResource('getProjectDB', function (Group $pools, Database $dbForPlatfor
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -879,7 +879,7 @@ Http::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorizati
return function (?Document $project = null) use ($pools, $cache, $authorization, &$database) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getSequence());
$database->setTenant((int) $project->getSequence());
return $database;
}
@@ -896,7 +896,7 @@ Http::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorizati
// set tenant
if ($project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getSequence());
$database->setTenant((int) $project->getSequence());
}
return $database;
+1 -1
View File
@@ -125,7 +125,7 @@ if (!function_exists('getProjectDB')) {
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
+5 -5
View File
@@ -112,7 +112,7 @@ Server::setResource('dbForProject', function (Cache $cache, Registry $register,
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -152,7 +152,7 @@ Server::setResource('getProjectDB', function (Group $pools, Database $dbForPlatf
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -174,7 +174,7 @@ Server::setResource('getProjectDB', function (Group $pools, Database $dbForPlatf
if (\in_array($dsn->getHost(), $sharedTables)) {
$database
->setSharedTables(true)
->setTenant($project->getSequence())
->setTenant((int) $project->getSequence())
->setNamespace($dsn->getParam('namespace'));
} else {
$database
@@ -197,7 +197,7 @@ Server::setResource('getLogsDB', function (Group $pools, Cache $cache, Authoriza
return function (?Document $project = null) use ($pools, $cache, $database, $authorization) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getSequence());
$database->setTenant((int) $project->getSequence());
return $database;
}
@@ -213,7 +213,7 @@ Server::setResource('getLogsDB', function (Group $pools, Cache $cache, Authoriza
->setMaxQueryValues(APP_DATABASE_QUERY_MAX_VALUES_WORKER);
if ($project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getSequence());
$database->setTenant((int) $project->getSequence());
}
return $database;
+1 -7
View File
@@ -61,7 +61,7 @@
"utopia-php/compression": "0.1.*",
"utopia-php/config": "1.*",
"utopia-php/console": "0.1.*",
"utopia-php/database": "dev-fix-collection-recreate as 5.3.15",
"utopia-php/database": "5.3.15",
"utopia-php/detector": "0.2.*",
"utopia-php/domains": "1.*",
"utopia-php/emails": "0.6.*",
@@ -97,12 +97,6 @@
"enshrined/svg-sanitize": "0.22.*",
"utopia-php/di": "0.1.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/utopia-php/database"
}
],
"require-dev": {
"ext-fileinfo": "*",
"appwrite/sdk-generator": "*",
Generated
+15 -54
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "13579de3d747c541fdcce4f709df8e57",
"content-hash": "bb9817c50945198d9528fbbf69d80b4a",
"packages": [
{
"name": "adhocore/jwt",
@@ -3850,16 +3850,16 @@
},
{
"name": "utopia-php/database",
"version": "dev-fix-collection-recreate",
"version": "5.3.15",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "5208630969dfdfbe8eda9c34c6b28ce711ece7c4"
"reference": "bb89e8c4a5d534fc7e650c4438aa796667fe160a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/5208630969dfdfbe8eda9c34c6b28ce711ece7c4",
"reference": "5208630969dfdfbe8eda9c34c6b28ce711ece7c4",
"url": "https://api.github.com/repos/utopia-php/database/zipball/bb89e8c4a5d534fc7e650c4438aa796667fe160a",
"reference": "bb89e8c4a5d534fc7e650c4438aa796667fe160a",
"shasum": ""
},
"require": {
@@ -3868,9 +3868,10 @@
"ext-pdo": "*",
"php": ">=8.4",
"utopia-php/cache": "1.*",
"utopia-php/framework": "0.33.*",
"utopia-php/console": "0.1.*",
"utopia-php/mongo": "1.*",
"utopia-php/pools": "1.*"
"utopia-php/pools": "1.*",
"utopia-php/validators": "0.2.*"
},
"require-dev": {
"fakerphp/faker": "1.23.*",
@@ -3880,7 +3881,7 @@
"phpunit/phpunit": "9.*",
"rregeer/phpunit-coverage-check": "0.3.*",
"swoole/ide-helper": "5.1.3",
"utopia-php/cli": "0.14.*"
"utopia-php/cli": "0.22.*"
},
"type": "library",
"autoload": {
@@ -3888,38 +3889,7 @@
"Utopia\\Database\\": "src/Database"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\E2E\\": "tests/e2e",
"Tests\\Unit\\": "tests/unit"
}
},
"scripts": {
"build": [
"Composer\\Config::disableProcessTimeout",
"docker compose build"
],
"start": [
"Composer\\Config::disableProcessTimeout",
"docker compose up -d"
],
"test": [
"Composer\\Config::disableProcessTimeout",
"docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml"
],
"lint": [
"php -d memory_limit=2G ./vendor/bin/pint --test"
],
"format": [
"php -d memory_limit=2G ./vendor/bin/pint"
],
"check": [
"./vendor/bin/phpstan analyse --level 7 src tests --memory-limit 2G"
],
"coverage": [
"./vendor/bin/coverage-check ./tmp/clover.xml 90"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -3932,10 +3902,10 @@
"utopia"
],
"support": {
"source": "https://github.com/utopia-php/database/tree/fix-collection-recreate",
"issues": "https://github.com/utopia-php/database/issues"
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/5.3.15"
},
"time": "2026-03-16T11:58:09+00:00"
"time": "2026-03-16T11:41:45+00:00"
},
{
"name": "utopia-php/detector",
@@ -8462,18 +8432,9 @@
"time": "2024-11-07T12:36:22+00:00"
}
],
"aliases": [
{
"package": "utopia-php/database",
"version": "dev-fix-collection-recreate",
"alias": "5.3.15",
"alias_normalized": "5.3.15.0"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"utopia-php/database": 20
},
"stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
+1 -1
View File
@@ -480,7 +480,7 @@ class StatsUsage extends Action
}
$documentClone = clone $stat;
$dbForLogs = ($this->getLogsDB)();
$documentClone->setAttribute('$tenant', $project->getSequence());
$documentClone->setAttribute('$tenant', (int) $project->getSequence());
$this->statDocuments[] = $documentClone;
}