diff --git a/app/controllers/api/project.php b/app/controllers/api/project.php index 010bd7c328..d24519e3fb 100644 --- a/app/controllers/api/project.php +++ b/app/controllers/api/project.php @@ -77,8 +77,6 @@ Http::get('/v1/project/usage') METRIC_NETWORK_REQUESTS, METRIC_NETWORK_INBOUND, METRIC_NETWORK_OUTBOUND, - METRIC_SITES_INBOUND, - METRIC_SITES_OUTBOUND, METRIC_USERS, METRIC_EXECUTIONS, METRIC_DATABASES_STORAGE, @@ -340,16 +338,6 @@ Http::get('/v1/project/usage') $projectBandwidth[$item['date']] += $item['value']; } - foreach ($usage[METRIC_SITES_INBOUND] as $item) { - $projectBandwidth[$item['date']] ??= 0; - $projectBandwidth[$item['date']] += $item['value']; - } - - foreach ($usage[METRIC_SITES_OUTBOUND] as $item) { - $projectBandwidth[$item['date']] ??= 0; - $projectBandwidth[$item['date']] += $item['value']; - } - $network = []; foreach ($projectBandwidth as $date => $value) { diff --git a/composer.lock b/composer.lock index c85716438e..bebb446af9 100644 --- a/composer.lock +++ b/composer.lock @@ -4058,16 +4058,16 @@ }, { "name": "utopia-php/domains", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/utopia-php/domains.git", - "reference": "20b6a6868234d766fef35a47814dccc66906c2af" + "reference": "b4896a6746f0fbe29dfd5e32f7790bd94c1af1e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/domains/zipball/20b6a6868234d766fef35a47814dccc66906c2af", - "reference": "20b6a6868234d766fef35a47814dccc66906c2af", + "url": "https://api.github.com/repos/utopia-php/domains/zipball/b4896a6746f0fbe29dfd5e32f7790bd94c1af1e6", + "reference": "b4896a6746f0fbe29dfd5e32f7790bd94c1af1e6", "shasum": "" }, "require": { @@ -4114,9 +4114,9 @@ ], "support": { "issues": "https://github.com/utopia-php/domains/issues", - "source": "https://github.com/utopia-php/domains/tree/1.0.1" + "source": "https://github.com/utopia-php/domains/tree/1.0.2" }, - "time": "2026-02-06T12:45:12+00:00" + "time": "2026-02-25T08:18:25+00:00" }, { "name": "utopia-php/dsn", @@ -5438,16 +5438,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "3604b7e403bbf35ac1ce707422a19a9ed55cdc84" + "reference": "6ff411f26f2750eea05c7598c14bb3a2ada898cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3604b7e403bbf35ac1ce707422a19a9ed55cdc84", - "reference": "3604b7e403bbf35ac1ce707422a19a9ed55cdc84", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6ff411f26f2750eea05c7598c14bb3a2ada898cb", + "reference": "6ff411f26f2750eea05c7598c14bb3a2ada898cb", "shasum": "" }, "require": { @@ -5483,9 +5483,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.11.0" + "source": "https://github.com/appwrite/sdk-generator/tree/1.11.1" }, - "time": "2026-02-25T04:42:44+00:00" + "time": "2026-02-25T07:15:19+00:00" }, { "name": "brianium/paratest", diff --git a/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php index f12c5cd6b2..8368b272f1 100644 --- a/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php +++ b/src/Appwrite/Platform/Modules/Console/Http/Variables/Get.php @@ -102,6 +102,7 @@ class Get extends Action 'supportForAttributeResizing' => $adapter->getSupportForAttributeResizing(), 'supportForSchemas' => $adapter->getSupportForSchemas(), 'maxIndexLength' => $adapter->getMaxIndexLength(), + 'supportForIntegerIds' => $adapter->getIdAttributeType() === 'integer', ]); $response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES); diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 1a3fffb479..7c7fc96b2f 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -839,10 +839,14 @@ class OpenAPI3 extends Format case 'string': case 'datetime': case 'payload': - case 'id': $type = 'string'; break; + case 'id': + $type = 'integer'; + $format = $rule['format'] ?? 'int32'; + break; + case 'enum': $type = 'string'; break; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index bad6117d07..558e911c33 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -819,10 +819,14 @@ class Swagger2 extends Format switch ($rule['type']) { case 'string': case 'datetime': - case 'id': $type = 'string'; break; + case 'id': + $type = 'integer'; + $format = $rule['format'] ?? 'int32'; + break; + case 'enum': $type = 'string'; break; diff --git a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php index 721a31165f..5ca01ca010 100644 --- a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php +++ b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php @@ -196,6 +196,15 @@ class ConsoleVariables extends Model 'example' => 768, ] ) + ->addRule( + 'supportForIntegerIds', + [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the database adapter uses integer sequence IDs.', + 'default' => true, + 'example' => true, + ] + ) ; } diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index f5fe25f233..e0aca32b3b 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -83,9 +83,8 @@ class Document extends Any $document->removeAttribute('$collection'); $document->removeAttribute('$tenant'); - if (!$document->isEmpty()) { - $sequence = $document->getAttribute('$sequence', ''); - $document->setAttribute('$sequence', $sequence); + if (!$document->isEmpty() && \is_numeric($document->getAttribute('$sequence', 0))) { + $document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0)); } foreach ($document->getAttributes() as $attribute) { diff --git a/src/Appwrite/Utopia/Response/Model/Row.php b/src/Appwrite/Utopia/Response/Model/Row.php index e1ea132d0b..a96df44bc3 100644 --- a/src/Appwrite/Utopia/Response/Model/Row.php +++ b/src/Appwrite/Utopia/Response/Model/Row.php @@ -82,8 +82,10 @@ class Row extends Any { $document->removeAttribute('$collection'); $document->removeAttribute('$tenant'); - $sequence = $document->getAttribute('$sequence', ''); - $document->setAttribute('$sequence', $sequence); + + if (!$document->isEmpty() && \is_numeric($document->getAttribute('$sequence', 0))) { + $document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0)); + } foreach ($document->getAttributes() as $column) { if (\is_array($column)) { diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 3d16db1b1b..b0203cbf40 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -143,6 +143,14 @@ abstract class Scope extends TestCase return $this->getConsoleVariables()['maxIndexLength'] ?? 768; } + /** + * Check if the database adapter uses integer sequence IDs + */ + protected function getSupportForIntegerIds(): bool + { + return $this->getConsoleVariables()['supportForIntegerIds'] ?? true; + } + protected function getLastEmail(int $limit = 1, ?callable $probe = null): array { $result = []; diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 780653dc96..23d9908029 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -2567,6 +2567,10 @@ trait DatabasesBase $this->assertEquals($document1['body']['birthDay'], '1975-06-12T12:12:55.000+00:00'); $this->assertTrue(array_key_exists('$sequence', $document1['body'])); + $this->getSupportForIntegerIds() + ? $this->assertIsInt($document1['body']['$sequence']) + : $this->assertIsString($document1['body']['$sequence']); + $this->assertEquals(201, $document2['headers']['status-code']); $this->assertEquals($data['moviesId'], $document2['body'][$this->getContainerIdResponseKey()]); $this->assertArrayNotHasKey('$collection', $document2['body']); @@ -2637,7 +2641,10 @@ trait DatabasesBase /** * Resubmit same document, nothing to update */ - $this->assertIsString($document['body']['$sequence']); + $this->getSupportForIntegerIds() + ? $this->assertIsInt($document['body']['$sequence']) + : $this->assertIsString($document['body']['$sequence']); + $upsertData = [ 'title' => 'Thor: Ragnarok', 'releaseYear' => 2000,