diff --git a/composer.lock b/composer.lock index 49db72a67e..bebb446af9 100644 --- a/composer.lock +++ b/composer.lock @@ -3403,16 +3403,16 @@ }, { "name": "utopia-php/agents", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/agents.git", - "reference": "9291c4616b794bd3f0a342bfabaad2c2a4de7a19" + "reference": "052227953678a30ecc4b5467401fcb0b2386471e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/agents/zipball/9291c4616b794bd3f0a342bfabaad2c2a4de7a19", - "reference": "9291c4616b794bd3f0a342bfabaad2c2a4de7a19", + "url": "https://api.github.com/repos/utopia-php/agents/zipball/052227953678a30ecc4b5467401fcb0b2386471e", + "reference": "052227953678a30ecc4b5467401fcb0b2386471e", "shasum": "" }, "require": { @@ -3420,10 +3420,9 @@ "utopia-php/fetch": "0.5.*" }, "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "1.9.x-dev", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "laravel/pint": "^1.18", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^12.0" }, "type": "library", "autoload": { @@ -3451,9 +3450,9 @@ ], "support": { "issues": "https://github.com/utopia-php/agents/issues", - "source": "https://github.com/utopia-php/agents/tree/1.2.0" + "source": "https://github.com/utopia-php/agents/tree/1.2.1" }, - "time": "2026-02-23T12:08:31+00:00" + "time": "2026-02-24T06:03:55+00:00" }, { "name": "utopia-php/analytics", @@ -4059,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": { @@ -4115,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", @@ -5439,16 +5438,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.10.2", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "b31e6b4209ecad46d2fef509dc59f1945d0e83cb" + "reference": "6ff411f26f2750eea05c7598c14bb3a2ada898cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/b31e6b4209ecad46d2fef509dc59f1945d0e83cb", - "reference": "b31e6b4209ecad46d2fef509dc59f1945d0e83cb", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6ff411f26f2750eea05c7598c14bb3a2ada898cb", + "reference": "6ff411f26f2750eea05c7598c14bb3a2ada898cb", "shasum": "" }, "require": { @@ -5484,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.10.2" + "source": "https://github.com/appwrite/sdk-generator/tree/1.11.1" }, - "time": "2026-02-23T04:04:15+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,