From 03c73ac0aab0b66116065540341e904854dd7880 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 15:50:59 +0530 Subject: [PATCH 01/31] added big int attributes --- composer.json | 4 +- composer.lock | 48 ++++--- .../databases/create-bigint-attribute.md | 1 + .../databases/update-bigint-attribute.md | 1 + .../Collections/Attributes/BigInt/Create.php | 120 ++++++++++++++++++ .../Collections/Attributes/BigInt/Update.php | 106 ++++++++++++++++ .../Databases/Services/Registry/Legacy.php | 6 + 7 files changed, 268 insertions(+), 18 deletions(-) create mode 100644 docs/references/databases/create-bigint-attribute.md create mode 100644 docs/references/databases/update-bigint-attribute.md create mode 100644 src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php create mode 100644 src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php diff --git a/composer.json b/composer.json index 65838a1615..ba7d89d6ed 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", - "utopia-php/database": "5.*", + "utopia-php/database": "dev-big-init as 5.7", "utopia-php/agents": "1.*", "utopia-php/detector": "0.2.*", "utopia-php/domains": "1.*", @@ -73,7 +73,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.20.*", - "utopia-php/migration": "1.8.*", + "utopia-php/migration": "dev-big-int as 1.8.6", "utopia-php/platform": "0.7.*", "utopia-php/pools": "1.*", "utopia-php/span": "1.1.*", diff --git a/composer.lock b/composer.lock index 1441bf06d1..036415e843 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "f9225f2b580de0ccb796b2fb8c881384", + "content-hash": "4bdbec3c3569eac8ed04d24a71ddaa34", "packages": [ { "name": "adhocore/jwt", @@ -3850,16 +3850,16 @@ }, { "name": "utopia-php/database", - "version": "5.3.17", + "version": "dev-big-init", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "cff2b6ed63d3291b74110d086e16ff089fe05993" + "reference": "ef5c77972a95129eb929cce6c8f7c674db930ec9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/cff2b6ed63d3291b74110d086e16ff089fe05993", - "reference": "cff2b6ed63d3291b74110d086e16ff089fe05993", + "url": "https://api.github.com/repos/utopia-php/database/zipball/ef5c77972a95129eb929cce6c8f7c674db930ec9", + "reference": "ef5c77972a95129eb929cce6c8f7c674db930ec9", "shasum": "" }, "require": { @@ -3903,9 +3903,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/5.3.17" + "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-03-20T01:18:52+00:00" + "time": "2026-03-30T06:31:05+00:00" }, { "name": "utopia-php/detector", @@ -4518,16 +4518,16 @@ }, { "name": "utopia-php/migration", - "version": "1.8.3", + "version": "dev-big-int", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "8633523b3343d492427331b6eec53f020f6ab7a7" + "reference": "9e8708883677661ac568ba41f7a0b79cd6f04253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/8633523b3343d492427331b6eec53f020f6ab7a7", - "reference": "8633523b3343d492427331b6eec53f020f6ab7a7", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/9e8708883677661ac568ba41f7a0b79cd6f04253", + "reference": "9e8708883677661ac568ba41f7a0b79cd6f04253", "shasum": "" }, "require": { @@ -4536,7 +4536,7 @@ "ext-openssl": "*", "halaxa/json-machine": "^1.2", "php": ">=8.1", - "utopia-php/database": "5.*", + "utopia-php/database": "dev-big-init as 5.4", "utopia-php/dsn": "0.2.*", "utopia-php/storage": "1.0.*" }, @@ -4567,9 +4567,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.8.3" + "source": "https://github.com/utopia-php/migration/tree/big-int" }, - "time": "2026-03-19T09:18:47+00:00" + "time": "2026-03-30T10:03:42+00:00" }, { "name": "utopia-php/mongo", @@ -8433,9 +8433,25 @@ "time": "2024-11-07T12:36:22+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-big-init", + "alias": "5.7", + "alias_normalized": "5.7.0.0" + }, + { + "package": "utopia-php/migration", + "version": "dev-big-int", + "alias": "1.8.6", + "alias_normalized": "1.8.6.0" + } + ], "minimum-stability": "dev", - "stability-flags": {}, + "stability-flags": { + "utopia-php/database": 20, + "utopia-php/migration": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/docs/references/databases/create-bigint-attribute.md b/docs/references/databases/create-bigint-attribute.md new file mode 100644 index 0000000000..6fb607304b --- /dev/null +++ b/docs/references/databases/create-bigint-attribute.md @@ -0,0 +1 @@ +Create a bigint attribute. Optionally, minimum and maximum values can be provided. diff --git a/docs/references/databases/update-bigint-attribute.md b/docs/references/databases/update-bigint-attribute.md new file mode 100644 index 0000000000..4a301c2216 --- /dev/null +++ b/docs/references/databases/update-bigint-attribute.md @@ -0,0 +1 @@ +Update a bigint attribute. Changing the `default` value will not update already existing documents. diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php new file mode 100644 index 0000000000..ecae3c3db3 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -0,0 +1,120 @@ +setHttpMethod(self::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/attributes/bigint') + ->desc('Create bigint attribute') + ->groups(['api', 'database', 'schema']) + ->label('scope', 'collections.write') + ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') + ->label('audits.event', 'attribute.create') + ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('sdk', new Method( + namespace: $this->getSDKNamespace(), + group: $this->getSDKGroup(), + name: self::getName(), + description: '/docs/references/databases/create-bigint-attribute.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: SwooleResponse::STATUS_CODE_ACCEPTED, + model: $this->getResponseModel(), + ) + ], + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createIntegerColumn', + ), + )) + ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) + ->param('collectionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Collection ID.', false, ['dbForProject']) + ->param('key', '', fn (Database $dbForProject) => new Key(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Attribute Key.', false, ['dbForProject']) + ->param('required', null, new Boolean(), 'Is attribute required?') + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when attribute is required.', true) + ->param('array', false, new Boolean(), 'Is attribute an array?', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDatabase') + ->inject('queueForEvents') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?int $min, ?int $max, ?int $default, bool $array, UtopiaResponse $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents, Authorization $authorization): void + { + $min ??= \PHP_INT_MIN; + $max ??= \PHP_INT_MAX; + + if ($min > $max) { + throw new Exception($this->getInvalidValueException(), 'Minimum value must be lesser than maximum value'); + } + + $validator = new Range($min, $max, Database::VAR_INTEGER); + if (!\is_null($default) && !$validator->isValid($default)) { + throw new Exception($this->getInvalidValueException(), $validator->getDescription()); + } + + // `bigint` is always stored as a 64-bit integer. + $size = 8; + + $attribute = $this->createAttribute($databaseId, $collectionId, new Document([ + 'key' => $key, + 'type' => Database::VAR_INTEGER, + 'size' => $size, + 'required' => $required, + 'default' => $default, + 'array' => $array, + 'format' => APP_DATABASE_ATTRIBUTE_INT_RANGE, + 'formatOptions' => ['min' => $min, 'max' => $max], + ]), $response, $dbForProject, $queueForDatabase, $queueForEvents, $authorization); + + $formatOptions = $attribute->getAttribute('formatOptions', []); + if (!empty($formatOptions)) { + $attribute->setAttribute('min', \intval($formatOptions['min'])); + $attribute->setAttribute('max', \intval($formatOptions['max'])); + } + + $response + ->setStatusCode(SwooleResponse::STATUS_CODE_ACCEPTED) + ->dynamic($attribute, $this->getResponseModel()); + } +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php new file mode 100644 index 0000000000..2010b51208 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php @@ -0,0 +1,106 @@ +setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/attributes/bigint/:key') + ->desc('Update bigint attribute') + ->groups(['api', 'database', 'schema']) + ->label('scope', 'collections.write') + ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') + ->label('audits.event', 'attribute.update') + ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('sdk', new Method( + namespace: $this->getSDKNamespace(), + group: $this->getSDKGroup(), + name: self::getName(), + description: '/docs/references/databases/update-bigint-attribute.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: SwooleResponse::STATUS_CODE_OK, + model: $this->getResponseModel(), + ) + ], + contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.updateIntegerColumn', + ), + )) + ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) + ->param('collectionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Collection ID.', false, ['dbForProject']) + ->param('key', '', fn (Database $dbForProject) => new Key(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Attribute Key.', false, ['dbForProject']) + ->param('required', null, new Boolean(), 'Is attribute required?') + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when attribute is required.') + ->param('newKey', null, fn (Database $dbForProject) => new Nullable(new Key(false, $dbForProject->getAdapter()->getMaxUIDLength())), 'New Attribute Key.', true, ['dbForProject']) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('authorization') + ->callback($this->action(...)); + } + + public function action(string $databaseId, string $collectionId, string $key, ?bool $required, ?int $min, ?int $max, ?int $default, ?string $newKey, UtopiaResponse $response, Database $dbForProject, Event $queueForEvents, Authorization $authorization): void + { + $attribute = $this->updateAttribute( + databaseId: $databaseId, + collectionId: $collectionId, + key: $key, + dbForProject: $dbForProject, + queueForEvents: $queueForEvents, + authorization: $authorization, + type: Database::VAR_INTEGER, + default: $default, + required: $required, + min: $min, + max: $max, + newKey: $newKey + ); + + $formatOptions = $attribute->getAttribute('formatOptions', []); + if (!empty($formatOptions)) { + $attribute->setAttribute('min', \intval($formatOptions['min'])); + $attribute->setAttribute('max', \intval($formatOptions['max'])); + } + + $response + ->setStatusCode(SwooleResponse::STATUS_CODE_OK) + ->dynamic($attribute, $this->getResponseModel()); + } +} diff --git a/src/Appwrite/Platform/Modules/Databases/Services/Registry/Legacy.php b/src/Appwrite/Platform/Modules/Databases/Services/Registry/Legacy.php index a8d2205236..a2fba9efb3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Services/Registry/Legacy.php +++ b/src/Appwrite/Platform/Modules/Databases/Services/Registry/Legacy.php @@ -2,6 +2,8 @@ namespace Appwrite\Platform\Modules\Databases\Services\Registry; +use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\BigInt\Create as CreateBigIntAttribute; +use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\BigInt\Update as UpdateBigIntAttribute; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Boolean\Create as CreateBooleanAttribute; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Boolean\Update as UpdateBooleanAttribute; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Datetime\Create as CreateDatetimeAttribute; @@ -171,6 +173,10 @@ class Legacy extends Base $service->addAction(CreateIntegerAttribute::getName(), new CreateIntegerAttribute()); $service->addAction(UpdateIntegerAttribute::getName(), new UpdateIntegerAttribute()); + // Attribute: BigInt + $service->addAction(CreateBigIntAttribute::getName(), new CreateBigIntAttribute()); + $service->addAction(UpdateBigIntAttribute::getName(), new UpdateBigIntAttribute()); + // Attribute: IP $service->addAction(CreateIPAttribute::getName(), new CreateIPAttribute()); $service->addAction(UpdateIPAttribute::getName(), new UpdateIPAttribute()); From ffa3f741ed41525b5080cd57c3ca4bbb353df73d Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 15:53:06 +0530 Subject: [PATCH 02/31] added bigint columns --- .../tablesdb/create-bigint-column.md | 1 + .../tablesdb/update-bigint-column.md | 1 + .../TablesDB/Tables/Columns/BigInt/Create.php | 70 ++++++++++++++++++ .../TablesDB/Tables/Columns/BigInt/Update.php | 71 +++++++++++++++++++ .../Databases/Services/Registry/TablesDB.php | 6 ++ 5 files changed, 149 insertions(+) create mode 100644 docs/references/tablesdb/create-bigint-column.md create mode 100644 docs/references/tablesdb/update-bigint-column.md create mode 100644 src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php create mode 100644 src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php diff --git a/docs/references/tablesdb/create-bigint-column.md b/docs/references/tablesdb/create-bigint-column.md new file mode 100644 index 0000000000..7bbbb5aac6 --- /dev/null +++ b/docs/references/tablesdb/create-bigint-column.md @@ -0,0 +1 @@ +Create a bigint column. Optionally, minimum and maximum values can be provided. diff --git a/docs/references/tablesdb/update-bigint-column.md b/docs/references/tablesdb/update-bigint-column.md new file mode 100644 index 0000000000..0dde070f6f --- /dev/null +++ b/docs/references/tablesdb/update-bigint-column.md @@ -0,0 +1 @@ +Update a bigint column. Changing the `default` value will not update already existing rows. diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php new file mode 100644 index 0000000000..514e13aa32 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php @@ -0,0 +1,70 @@ +setHttpMethod(self::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/columns/bigint') + ->desc('Create bigint column') + ->groups(['api', 'database', 'schema']) + ->label('scope', ['tables.write', 'collections.write']) + ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') + ->label('audits.event', 'column.create') + ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('sdk', new Method( + namespace: $this->getSDKNamespace(), + group: $this->getSDKGroup(), + name: self::getName(), + description: '/docs/references/tablesdb/create-bigint-column.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: SwooleResponse::STATUS_CODE_ACCEPTED, + model: $this->getResponseModel(), + ) + ] + )) + ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) + ->param('tableId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Table ID.', false, ['dbForProject']) + ->param('key', '', fn (Database $dbForProject) => new Key(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Column Key.', false, ['dbForProject']) + ->param('required', null, new Boolean(), 'Is column required?') + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.', true) + ->param('array', false, new Boolean(), 'Is column an array?', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDatabase') + ->inject('queueForEvents') + ->inject('authorization') + ->callback($this->action(...)); + } +} diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php new file mode 100644 index 0000000000..6f4343cbc9 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php @@ -0,0 +1,71 @@ +setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/columns/bigint/:key') + ->desc('Update bigint column') + ->groups(['api', 'database', 'schema']) + ->label('scope', ['tables.write', 'collections.write']) + ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') + ->label('audits.event', 'column.update') + ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('sdk', new Method( + namespace: $this->getSDKNamespace(), + group: $this->getSDKGroup(), + name: self::getName(), + description: '/docs/references/tablesdb/update-bigint-column.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: SwooleResponse::STATUS_CODE_OK, + model: $this->getResponseModel(), + ) + ], + contentType: ContentType::JSON + )) + ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) + ->param('tableId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Table ID.', false, ['dbForProject']) + ->param('key', '', fn (Database $dbForProject) => new Key(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Column Key.', false, ['dbForProject']) + ->param('required', null, new Boolean(), 'Is column required?') + ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) + ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.') + ->param('newKey', null, fn (Database $dbForProject) => new Nullable(new Key(false, $dbForProject->getAdapter()->getMaxUIDLength())), 'New Column Key.', true, ['dbForProject']) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('authorization') + ->callback($this->action(...)); + } +} diff --git a/src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php b/src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php index 965e0929fb..765fbd4421 100644 --- a/src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php +++ b/src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php @@ -5,6 +5,8 @@ namespace Appwrite\Platform\Modules\Databases\Services\Registry; use Appwrite\Platform\Modules\Databases\Http\TablesDB\Create as CreateTablesDatabase; use Appwrite\Platform\Modules\Databases\Http\TablesDB\Delete as DeleteTablesDatabase; use Appwrite\Platform\Modules\Databases\Http\TablesDB\Get as GetTablesDatabase; +use Appwrite\Platform\Modules\Databases\Http\TablesDB\Tables\Columns\BigInt\Create as CreateBigInt; +use Appwrite\Platform\Modules\Databases\Http\TablesDB\Tables\Columns\BigInt\Update as UpdateBigInt; use Appwrite\Platform\Modules\Databases\Http\TablesDB\Tables\Columns\Boolean\Create as CreateBoolean; use Appwrite\Platform\Modules\Databases\Http\TablesDB\Tables\Columns\Boolean\Update as UpdateBoolean; use Appwrite\Platform\Modules\Databases\Http\TablesDB\Tables\Columns\Datetime\Create as CreateDatetime; @@ -151,6 +153,10 @@ class TablesDB extends Base $service->addAction(CreateInteger::getName(), new CreateInteger()); $service->addAction(UpdateInteger::getName(), new UpdateInteger()); + // Column: BigInt + $service->addAction(CreateBigInt::getName(), new CreateBigInt()); + $service->addAction(UpdateBigInt::getName(), new UpdateBigInt()); + // Column: IP $service->addAction(CreateIP::getName(), new CreateIP()); $service->addAction(UpdateIP::getName(), new UpdateIP()); From 01db1efbc48bd3a30410c0ee1230db6939feeae7 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 16:08:21 +0530 Subject: [PATCH 03/31] added tests --- .../TablesDB/DatabasesNumericTypesTest.php | 400 ++++++++++++++++++ 1 file changed, 400 insertions(+) create mode 100644 tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php diff --git a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php new file mode 100644 index 0000000000..d341681a65 --- /dev/null +++ b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php @@ -0,0 +1,400 @@ +getProject()['$id'] ?? 'default'; + if (!empty(static::$setupCache[$cacheKey])) { + return static::$setupCache[$cacheKey]; + } + + $projectId = $this->getProject()['$id']; + $apiKey = $this->getProject()['apiKey']; + $headers = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]; + + $database = $this->client->call(Client::METHOD_POST, '/tablesdb', $headers, [ + 'databaseId' => ID::unique(), + 'name' => 'Numeric Types Test Database', + ]); + + $this->assertEquals(201, $database['headers']['status-code']); + $databaseId = $database['body']['$id']; + + $table = $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables', $headers, [ + 'tableId' => ID::unique(), + 'name' => 'Numeric Types Table', + 'rowSecurity' => true, + 'permissions' => [ + Permission::create(Role::any()), + Permission::read(Role::any()), + ], + ]); + + $this->assertEquals(201, $table['headers']['status-code']); + $tableId = $table['body']['$id']; + + // Create integer column + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer', $headers, [ + 'key' => 'integer_field', + 'required' => false, + 'min' => -10, + 'max' => 10, + 'default' => 0, + ]); + + // Create bigint column + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint', $headers, [ + 'key' => 'bigint_field', + 'required' => false, + 'min' => -900719925, + 'max' => 900719925, + 'default' => 123, + ]); + + // Cache before waiting so that if waitForAllAttributes times out, + // subsequent calls don't try to re-create the same columns (causing 409) + static::$setupCache[$cacheKey] = [ + 'databaseId' => $databaseId, + 'tableId' => $tableId, + ]; + + // Wait for all columns to be available + $this->waitForAllAttributes($databaseId, $tableId); + + return static::$setupCache[$cacheKey]; + } + + /** + * Setup database/table without caching so mutations (update/delete) don't + * affect other tests that might be executed in a different order. + */ + protected function setupFreshDatabaseAndTable(): array + { + $projectId = $this->getProject()['$id']; + $apiKey = $this->getProject()['apiKey']; + $headers = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]; + + $database = $this->client->call(Client::METHOD_POST, '/tablesdb', $headers, [ + 'databaseId' => ID::unique(), + 'name' => 'Numeric Types Test Database', + ]); + + $this->assertEquals(201, $database['headers']['status-code']); + $databaseId = $database['body']['$id']; + + $table = $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables', $headers, [ + 'tableId' => ID::unique(), + 'name' => 'Numeric Types Table', + 'rowSecurity' => true, + 'permissions' => [ + Permission::create(Role::any()), + Permission::read(Role::any()), + ], + ]); + + $this->assertEquals(201, $table['headers']['status-code']); + $tableId = $table['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer', $headers, [ + 'key' => 'integer_field', + 'required' => false, + 'min' => -10, + 'max' => 10, + 'default' => 0, + ]); + + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint', $headers, [ + 'key' => 'bigint_field', + 'required' => false, + 'min' => -900719925, + 'max' => 900719925, + 'default' => 123, + ]); + + $this->waitForAllAttributes($databaseId, $tableId); + + return [ + 'databaseId' => $databaseId, + 'tableId' => $tableId, + ]; + } + + public function testCreateDatabase(): void + { + $database = $this->client->call(Client::METHOD_POST, '/tablesdb', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'databaseId' => ID::unique(), + 'name' => 'Numeric Types Test Database', + ]); + + $this->assertEquals(201, $database['headers']['status-code']); + } + + public function testCreateTable(): void + { + $data = $this->setupDatabaseAndTable(); + + $table = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $data['databaseId'] . '/tables/' . $data['tableId'], [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $table['headers']['status-code']); + $this->assertEquals($data['tableId'], $table['body']['$id']); + } + + public function testGetIntegerAndBigIntColumns(): void + { + $data = $this->setupDatabaseAndTable(); + $databaseId = $data['databaseId']; + $tableId = $data['tableId']; + + $integerColumn = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $integerColumn['headers']['status-code']); + $this->assertEquals('integer_field', $integerColumn['body']['key']); + $this->assertEquals('integer', $integerColumn['body']['type']); + $this->assertEquals(false, $integerColumn['body']['required']); + $this->assertEquals(false, $integerColumn['body']['array']); + $this->assertEquals(-10, $integerColumn['body']['min']); + $this->assertEquals(10, $integerColumn['body']['max']); + $this->assertEquals(0, $integerColumn['body']['default']); + + $bigintColumn = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $bigintColumn['headers']['status-code']); + $this->assertEquals('bigint_field', $bigintColumn['body']['key']); + + // Some implementations may still represent bigint columns as integer internally. + $this->assertTrue(\in_array($bigintColumn['body']['type'], ['bigint', 'integer'], true)); + $this->assertEquals(false, $bigintColumn['body']['required']); + $this->assertEquals(false, $bigintColumn['body']['array']); + $this->assertEquals(-900719925, $bigintColumn['body']['min']); + $this->assertEquals(900719925, $bigintColumn['body']['max']); + $this->assertEquals(123, $bigintColumn['body']['default']); + } + + public function testListColumnsWithNumericTypes(): void + { + $data = $this->setupDatabaseAndTable(); + $databaseId = $data['databaseId']; + $tableId = $data['tableId']; + + $columns = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $columns['headers']['status-code']); + $this->assertIsArray($columns['body']['columns']); + $this->assertGreaterThan(0, $columns['body']['total']); + + $columnKeys = array_map(fn ($col) => $col['key'], $columns['body']['columns']); + $this->assertContains('integer_field', $columnKeys); + $this->assertContains('bigint_field', $columnKeys); + + $columnTypeByKey = []; + foreach ($columns['body']['columns'] as $col) { + $columnTypeByKey[$col['key']] = $col['type']; + } + + $this->assertEquals('integer', $columnTypeByKey['integer_field']); + $this->assertTrue(\in_array($columnTypeByKey['bigint_field'], ['bigint', 'integer'], true)); + } + + public function testCreateRowWithIntegerAndBigIntTypes(): void + { + $data = $this->setupDatabaseAndTable(); + $databaseId = $data['databaseId']; + $tableId = $data['tableId']; + + $row = $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'rowId' => ID::unique(), + 'data' => [ + 'integer_field' => 5, + 'bigint_field' => 456, + ], + 'permissions' => [ + Permission::read(Role::any()), + ], + ]); + + $this->assertEquals(201, $row['headers']['status-code']); + $this->assertEquals(5, $row['body']['integer_field']); + $this->assertEquals(456, $row['body']['bigint_field']); + } + + public function testUpdateIntegerAndBigIntColumns(): void + { + $data = $this->setupFreshDatabaseAndTable(); + $databaseId = $data['databaseId']; + $tableId = $data['tableId']; + + // Update integer column + $updateInteger = $this->client->call( + Client::METHOD_PATCH, + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer_field', + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], + [ + 'required' => false, + 'min' => -20, + 'max' => 20, + 'default' => 3, + ] + ); + + $this->assertEquals(200, $updateInteger['headers']['status-code']); + + $this->assertEventually(function () use ($databaseId, $tableId) { + $column = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $column['headers']['status-code']); + $this->assertEquals(-20, $column['body']['min']); + $this->assertEquals(20, $column['body']['max']); + $this->assertEquals(3, $column['body']['default']); + }, 30000, 250); + + // Update bigint column + $updateBigint = $this->client->call( + Client::METHOD_PATCH, + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint_field', + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], + [ + 'required' => false, + 'min' => -999, + 'max' => 999, + 'default' => 10, + ] + ); + + $this->assertEquals(200, $updateBigint['headers']['status-code']); + + $this->assertEventually(function () use ($databaseId, $tableId) { + $column = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $column['headers']['status-code']); + $this->assertEquals(-999, $column['body']['min']); + $this->assertEquals(999, $column['body']['max']); + $this->assertEquals(10, $column['body']['default']); + }, 30000, 250); + } + + public function testDeleteIntegerAndBigIntColumns(): void + { + $data = $this->setupFreshDatabaseAndTable(); + $databaseId = $data['databaseId']; + $tableId = $data['tableId']; + + // Delete integer column + $deleteInteger = $this->client->call( + Client::METHOD_DELETE, + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer_field', + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ] + ); + + $this->assertEquals(204, $deleteInteger['headers']['status-code']); + + $this->assertEventually(function () use ($databaseId, $tableId) { + $column = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(404, $column['headers']['status-code']); + }, 30000, 250); + + // Delete bigint column + $deleteBigint = $this->client->call( + Client::METHOD_DELETE, + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint_field', + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ] + ); + + $this->assertEquals(204, $deleteBigint['headers']['status-code']); + + $this->assertEventually(function () use ($databaseId, $tableId) { + $column = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(404, $column['headers']['status-code']); + }, 30000, 250); + } +} From a9ed74c6a83d52e30c719a733e0bbe48f20f05ec Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 16:11:42 +0530 Subject: [PATCH 04/31] added tests to migration --- tests/e2e/Services/Migrations/MigrationsBase.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 1e8b1f5ad3..0dc62a3be9 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1572,6 +1572,19 @@ trait MigrationsBase $this->assertEquals(202, $varchar['headers']['status-code']); + $bigint = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/bigint', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ], [ + 'key' => 'bigint', + 'min' => 0, + 'max' => 100000, + 'required' => false, + ]); + + $this->assertEquals(202, $bigint['headers']['status-code']); + $mediumtext = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/mediumtext', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -1622,6 +1635,7 @@ trait MigrationsBase 'mediumtext' => 'mediumText', 'longtext' => 'longText', 'varchar' => 'varchar', + 'bigint' => $i * 1000, ] ]); @@ -1710,6 +1724,8 @@ trait MigrationsBase $this->assertStringContainsString('mediumText', $csvData, 'CSV should contain the medium column header'); $this->assertStringContainsString('longText', $csvData, 'CSV should contain the long text column header'); $this->assertStringContainsString('varchar', $csvData, 'CSV should contain the varchar column header'); + $this->assertStringContainsString('bigint', $csvData, 'CSV should contain the bigint column header'); + $this->assertStringContainsString('1000', $csvData, 'CSV should contain bigint test data'); // Cleanup $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId, [ From 77d195f0c3edfc222e1eb3a33113e98ec28023c3 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 16:17:44 +0530 Subject: [PATCH 05/31] updated response models --- app/init/models.php | 4 +++ .../Collections/Attributes/BigInt/Create.php | 2 +- .../Collections/Attributes/BigInt/Update.php | 2 +- .../TablesDB/Tables/Columns/BigInt/Create.php | 2 +- .../TablesDB/Tables/Columns/BigInt/Update.php | 2 +- src/Appwrite/Utopia/Response.php | 2 ++ .../Utopia/Response/Model/AttributeBigInt.php | 31 +++++++++++++++++++ .../Utopia/Response/Model/AttributeList.php | 1 + .../Utopia/Response/Model/Collection.php | 1 + .../Utopia/Response/Model/ColumnBigInt.php | 31 +++++++++++++++++++ .../Utopia/Response/Model/ColumnList.php | 1 + src/Appwrite/Utopia/Response/Model/Table.php | 1 + 12 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 src/Appwrite/Utopia/Response/Model/AttributeBigInt.php create mode 100644 src/Appwrite/Utopia/Response/Model/ColumnBigInt.php diff --git a/app/init/models.php b/app/init/models.php index bf6d67dd95..794401375b 100644 --- a/app/init/models.php +++ b/app/init/models.php @@ -11,6 +11,7 @@ use Appwrite\Utopia\Response\Model\AlgoScryptModified; use Appwrite\Utopia\Response\Model\AlgoSha; use Appwrite\Utopia\Response\Model\Any; use Appwrite\Utopia\Response\Model\Attribute; +use Appwrite\Utopia\Response\Model\AttributeBigInt; use Appwrite\Utopia\Response\Model\AttributeBoolean; use Appwrite\Utopia\Response\Model\AttributeDatetime; use Appwrite\Utopia\Response\Model\AttributeEmail; @@ -37,6 +38,7 @@ use Appwrite\Utopia\Response\Model\Branch; use Appwrite\Utopia\Response\Model\Bucket; use Appwrite\Utopia\Response\Model\Collection; use Appwrite\Utopia\Response\Model\Column; +use Appwrite\Utopia\Response\Model\ColumnBigInt; use Appwrite\Utopia\Response\Model\ColumnBoolean; use Appwrite\Utopia\Response\Model\ColumnDatetime; use Appwrite\Utopia\Response\Model\ColumnEmail; @@ -232,6 +234,7 @@ Response::setModel(new Attribute()); Response::setModel(new AttributeList()); Response::setModel(new AttributeString()); Response::setModel(new AttributeInteger()); +Response::setModel(new AttributeBigInt()); Response::setModel(new AttributeFloat()); Response::setModel(new AttributeBoolean()); Response::setModel(new AttributeEmail()); @@ -265,6 +268,7 @@ Response::setModel(new Column()); Response::setModel(new ColumnList()); Response::setModel(new ColumnString()); Response::setModel(new ColumnInteger()); +Response::setModel(new ColumnBigInt()); Response::setModel(new ColumnFloat()); Response::setModel(new ColumnBoolean()); Response::setModel(new ColumnEmail()); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index ecae3c3db3..f99ee38d91 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -31,7 +31,7 @@ class Create extends Action protected function getResponseModel(): string|array { - return UtopiaResponse::MODEL_ATTRIBUTE_INTEGER; + return UtopiaResponse::MODEL_ATTRIBUTE_BIGINT; } public function __construct() diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php index 2010b51208..8e4a060ace 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php @@ -28,7 +28,7 @@ class Update extends Action protected function getResponseModel(): string|array { - return UtopiaResponse::MODEL_ATTRIBUTE_INTEGER; + return UtopiaResponse::MODEL_ATTRIBUTE_BIGINT; } public function __construct() diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php index 514e13aa32..1b7b33291b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php @@ -24,7 +24,7 @@ class Create extends BigIntCreate protected function getResponseModel(): string|array { - return UtopiaResponse::MODEL_COLUMN_INTEGER; + return UtopiaResponse::MODEL_COLUMN_BIGINT; } public function __construct() diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php index 6f4343cbc9..387dd08238 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php @@ -25,7 +25,7 @@ class Update extends BigIntUpdate protected function getResponseModel(): string|array { - return UtopiaResponse::MODEL_COLUMN_INTEGER; + return UtopiaResponse::MODEL_COLUMN_BIGINT; } public function __construct() diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 99170a58c9..2f36270624 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -72,6 +72,7 @@ class Response extends SwooleResponse public const MODEL_ATTRIBUTE_LIST = 'attributeList'; public const MODEL_ATTRIBUTE_STRING = 'attributeString'; public const MODEL_ATTRIBUTE_INTEGER = 'attributeInteger'; + public const MODEL_ATTRIBUTE_BIGINT = 'attributeBigint'; public const MODEL_ATTRIBUTE_FLOAT = 'attributeFloat'; public const MODEL_ATTRIBUTE_BOOLEAN = 'attributeBoolean'; public const MODEL_ATTRIBUTE_EMAIL = 'attributeEmail'; @@ -95,6 +96,7 @@ class Response extends SwooleResponse public const MODEL_COLUMN_LIST = 'columnList'; public const MODEL_COLUMN_STRING = 'columnString'; public const MODEL_COLUMN_INTEGER = 'columnInteger'; + public const MODEL_COLUMN_BIGINT = 'columnBigint'; public const MODEL_COLUMN_FLOAT = 'columnFloat'; public const MODEL_COLUMN_BOOLEAN = 'columnBoolean'; public const MODEL_COLUMN_EMAIL = 'columnEmail'; diff --git a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php new file mode 100644 index 0000000000..9e0d918fe0 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php @@ -0,0 +1,31 @@ + self::TYPE_INTEGER, + 'size' => 8, + ]; + + public function __construct() + { + parent::__construct(); + + // Update example for the `type` field + $this->rules['type']['example'] = 'bigint'; + } + + public function getName(): string + { + return 'AttributeBigInt'; + } + + public function getType(): string + { + return Response::MODEL_ATTRIBUTE_BIGINT; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/AttributeList.php b/src/Appwrite/Utopia/Response/Model/AttributeList.php index 50189a80c3..70459c3df1 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeList.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeList.php @@ -20,6 +20,7 @@ class AttributeList extends Model 'type' => [ Response::MODEL_ATTRIBUTE_BOOLEAN, Response::MODEL_ATTRIBUTE_INTEGER, + Response::MODEL_ATTRIBUTE_BIGINT, Response::MODEL_ATTRIBUTE_FLOAT, Response::MODEL_ATTRIBUTE_EMAIL, Response::MODEL_ATTRIBUTE_ENUM, diff --git a/src/Appwrite/Utopia/Response/Model/Collection.php b/src/Appwrite/Utopia/Response/Model/Collection.php index 4ab7de8e4d..7fe335cf09 100644 --- a/src/Appwrite/Utopia/Response/Model/Collection.php +++ b/src/Appwrite/Utopia/Response/Model/Collection.php @@ -63,6 +63,7 @@ class Collection extends Model 'type' => [ Response::MODEL_ATTRIBUTE_BOOLEAN, Response::MODEL_ATTRIBUTE_INTEGER, + Response::MODEL_ATTRIBUTE_BIGINT, Response::MODEL_ATTRIBUTE_FLOAT, Response::MODEL_ATTRIBUTE_EMAIL, Response::MODEL_ATTRIBUTE_ENUM, diff --git a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php new file mode 100644 index 0000000000..9d7649f144 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php @@ -0,0 +1,31 @@ + self::TYPE_INTEGER, + 'size' => 8, + ]; + + public function __construct() + { + parent::__construct(); + + // Update example for the `type` field + $this->rules['type']['example'] = 'bigint'; + } + + public function getName(): string + { + return 'ColumnBigInt'; + } + + public function getType(): string + { + return Response::MODEL_COLUMN_BIGINT; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/ColumnList.php b/src/Appwrite/Utopia/Response/Model/ColumnList.php index e99223cd17..64cdbdcf07 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnList.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnList.php @@ -20,6 +20,7 @@ class ColumnList extends Model 'type' => [ Response::MODEL_COLUMN_BOOLEAN, Response::MODEL_COLUMN_INTEGER, + Response::MODEL_COLUMN_BIGINT, Response::MODEL_COLUMN_FLOAT, Response::MODEL_COLUMN_EMAIL, Response::MODEL_COLUMN_ENUM, diff --git a/src/Appwrite/Utopia/Response/Model/Table.php b/src/Appwrite/Utopia/Response/Model/Table.php index 20cd3ccca2..b08bc2e97c 100644 --- a/src/Appwrite/Utopia/Response/Model/Table.php +++ b/src/Appwrite/Utopia/Response/Model/Table.php @@ -64,6 +64,7 @@ class Table extends Model 'type' => [ Response::MODEL_COLUMN_BOOLEAN, Response::MODEL_COLUMN_INTEGER, + Response::MODEL_COLUMN_BIGINT, Response::MODEL_COLUMN_FLOAT, Response::MODEL_COLUMN_EMAIL, Response::MODEL_COLUMN_ENUM, From 89eb5c2254d44dab8106e09a2f2c9197e28f9362 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 17:14:38 +0530 Subject: [PATCH 06/31] Refactor response model attribute and column types to prioritize BigInt over Integer for more accurate type matching in AttributeList, Collection, ColumnList, and Table classes. --- src/Appwrite/Utopia/Response/Model/AttributeList.php | 4 +++- src/Appwrite/Utopia/Response/Model/Collection.php | 4 +++- src/Appwrite/Utopia/Response/Model/ColumnList.php | 4 +++- src/Appwrite/Utopia/Response/Model/Table.php | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/AttributeList.php b/src/Appwrite/Utopia/Response/Model/AttributeList.php index 70459c3df1..87d1dc8b9f 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeList.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeList.php @@ -19,8 +19,10 @@ class AttributeList extends Model ->addRule('attributes', [ 'type' => [ Response::MODEL_ATTRIBUTE_BOOLEAN, - Response::MODEL_ATTRIBUTE_INTEGER, + // BigInt must come before Integer: response model dispatch is "first match wins", + // and Integer matches all int types (including bigint), while BigInt is more specific (size=8). Response::MODEL_ATTRIBUTE_BIGINT, + Response::MODEL_ATTRIBUTE_INTEGER, Response::MODEL_ATTRIBUTE_FLOAT, Response::MODEL_ATTRIBUTE_EMAIL, Response::MODEL_ATTRIBUTE_ENUM, diff --git a/src/Appwrite/Utopia/Response/Model/Collection.php b/src/Appwrite/Utopia/Response/Model/Collection.php index 7fe335cf09..bc4de22858 100644 --- a/src/Appwrite/Utopia/Response/Model/Collection.php +++ b/src/Appwrite/Utopia/Response/Model/Collection.php @@ -62,8 +62,10 @@ class Collection extends Model ->addRule('attributes', [ 'type' => [ Response::MODEL_ATTRIBUTE_BOOLEAN, - Response::MODEL_ATTRIBUTE_INTEGER, + // BigInt must come before Integer: response model dispatch is "first match wins", + // and Integer matches all int types (including bigint), while BigInt is more specific (size=8). Response::MODEL_ATTRIBUTE_BIGINT, + Response::MODEL_ATTRIBUTE_INTEGER, Response::MODEL_ATTRIBUTE_FLOAT, Response::MODEL_ATTRIBUTE_EMAIL, Response::MODEL_ATTRIBUTE_ENUM, diff --git a/src/Appwrite/Utopia/Response/Model/ColumnList.php b/src/Appwrite/Utopia/Response/Model/ColumnList.php index 64cdbdcf07..0586015e4d 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnList.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnList.php @@ -19,8 +19,10 @@ class ColumnList extends Model ->addRule('columns', [ 'type' => [ Response::MODEL_COLUMN_BOOLEAN, - Response::MODEL_COLUMN_INTEGER, + // BigInt must come before Integer: response model dispatch is "first match wins", + // and Integer matches all int types (including bigint), while BigInt is more specific (size=8). Response::MODEL_COLUMN_BIGINT, + Response::MODEL_COLUMN_INTEGER, Response::MODEL_COLUMN_FLOAT, Response::MODEL_COLUMN_EMAIL, Response::MODEL_COLUMN_ENUM, diff --git a/src/Appwrite/Utopia/Response/Model/Table.php b/src/Appwrite/Utopia/Response/Model/Table.php index b08bc2e97c..f9f2804fe5 100644 --- a/src/Appwrite/Utopia/Response/Model/Table.php +++ b/src/Appwrite/Utopia/Response/Model/Table.php @@ -63,8 +63,10 @@ class Table extends Model ->addRule('columns', [ 'type' => [ Response::MODEL_COLUMN_BOOLEAN, - Response::MODEL_COLUMN_INTEGER, + // BigInt must come before Integer: response model dispatch is "first match wins", + // and Integer matches all int types (including bigint), while BigInt is more specific (size=8). Response::MODEL_COLUMN_BIGINT, + Response::MODEL_COLUMN_INTEGER, Response::MODEL_COLUMN_FLOAT, Response::MODEL_COLUMN_EMAIL, Response::MODEL_COLUMN_ENUM, From 5741041f33a543081e0654e6cd6a3682da18e842 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 17:32:49 +0530 Subject: [PATCH 07/31] updated tests --- tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php index d341681a65..66f08e6000 100644 --- a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php +++ b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php @@ -283,7 +283,7 @@ class DatabasesNumericTypesTest extends Scope // Update integer column $updateInteger = $this->client->call( Client::METHOD_PATCH, - '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer_field', + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer/integer_field', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -315,7 +315,7 @@ class DatabasesNumericTypesTest extends Scope // Update bigint column $updateBigint = $this->client->call( Client::METHOD_PATCH, - '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint_field', + '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint/bigint_field', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], From 19487cf56b353cc797a088e9368818bf25a64ad0 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k <83803257+ArnabChatterjee20k@users.noreply.github.com> Date: Mon, 30 Mar 2026 17:34:36 +0530 Subject: [PATCH 08/31] Update src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- .../Http/Databases/Collections/Attributes/BigInt/Create.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index f99ee38d91..6991b8ac16 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -58,9 +58,10 @@ class Create extends Action model: $this->getResponseModel(), ) ], + deprecated: new Deprecated( deprecated: new Deprecated( since: '1.8.0', - replaceWith: 'tablesDB.createIntegerColumn', + replaceWith: 'tablesDB.createBigIntColumn', ), )) ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) From e5d818ba44294c14124d5961032c586e31423b1f Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 17:38:24 +0530 Subject: [PATCH 09/31] updated --- .../Databases/Collections/Attributes/BigInt/Create.php | 2 +- .../Databases/Collections/Attributes/BigInt/Update.php | 2 +- tests/e2e/Services/Migrations/MigrationsBase.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index f99ee38d91..1add0a6015 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -60,7 +60,7 @@ class Create extends Action ], deprecated: new Deprecated( since: '1.8.0', - replaceWith: 'tablesDB.createIntegerColumn', + replaceWith: 'tablesDB.createBigIntColumn', ), )) ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php index 8e4a060ace..4c795527cb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php @@ -58,7 +58,7 @@ class Update extends Action contentType: ContentType::JSON, deprecated: new Deprecated( since: '1.8.0', - replaceWith: 'tablesDB.updateIntegerColumn', + replaceWith: 'tablesDB.updateBigIntColumn', ), )) ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 0dc62a3be9..fef0a6d577 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1578,8 +1578,8 @@ trait MigrationsBase 'x-appwrite-key' => $this->getProject()['apiKey'] ], [ 'key' => 'bigint', - 'min' => 0, - 'max' => 100000, + 'min' => 2147483648, + 'max' => 9223372036854775807, 'required' => false, ]); @@ -1635,7 +1635,7 @@ trait MigrationsBase 'mediumtext' => 'mediumText', 'longtext' => 'longText', 'varchar' => 'varchar', - 'bigint' => $i * 1000, + 'bigint' => 2147483648 + $i, ] ]); @@ -1725,7 +1725,7 @@ trait MigrationsBase $this->assertStringContainsString('longText', $csvData, 'CSV should contain the long text column header'); $this->assertStringContainsString('varchar', $csvData, 'CSV should contain the varchar column header'); $this->assertStringContainsString('bigint', $csvData, 'CSV should contain the bigint column header'); - $this->assertStringContainsString('1000', $csvData, 'CSV should contain bigint test data'); + $this->assertStringContainsString('2147483649', $csvData, 'CSV should contain bigint test data'); // Cleanup $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId, [ From 819863559ef83697c14fa545de4e8535cb16358d Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 17:45:25 +0530 Subject: [PATCH 10/31] Enhance BigInt support across database attributes and validation, updating types and tests for consistency. --- .../Http/Databases/Collections/Attributes/Action.php | 8 +++++++- .../Databases/Collections/Attributes/BigInt/Create.php | 5 ++--- .../Databases/Collections/Attributes/BigInt/Update.php | 2 +- src/Appwrite/Utopia/Response/Model/AttributeBigInt.php | 2 +- src/Appwrite/Utopia/Response/Model/ColumnBigInt.php | 2 +- tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php | 5 ++--- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index 0d562a2894..e4c02b40ce 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -237,6 +237,10 @@ abstract class Action extends UtopiaAction ? UtopiaResponse::MODEL_ATTRIBUTE_BOOLEAN : UtopiaResponse::MODEL_COLUMN_BOOLEAN, + Database::VAR_BIGINT => $isCollections + ? UtopiaResponse::MODEL_ATTRIBUTE_BIGINT + : UtopiaResponse::MODEL_COLUMN_BIGINT, + Database::VAR_INTEGER => $isCollections ? UtopiaResponse::MODEL_ATTRIBUTE_INTEGER : UtopiaResponse::MODEL_COLUMN_INTEGER, @@ -549,7 +553,9 @@ abstract class Action extends UtopiaAction } if ($attribute->getAttribute('format') === APP_DATABASE_ATTRIBUTE_INT_RANGE) { - $validator = new Range($min, $max, Database::VAR_INTEGER); + // Use bigint validator when updating a bigint attribute/column. + $rangeType = $type === Database::VAR_BIGINT ? Database::VAR_BIGINT : Database::VAR_INTEGER; + $validator = new Range($min, $max, $rangeType); } else { $validator = new Range($min, $max, Database::VAR_FLOAT); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index 6991b8ac16..a7df055094 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -58,7 +58,6 @@ class Create extends Action model: $this->getResponseModel(), ) ], - deprecated: new Deprecated( deprecated: new Deprecated( since: '1.8.0', replaceWith: 'tablesDB.createBigIntColumn', @@ -89,7 +88,7 @@ class Create extends Action throw new Exception($this->getInvalidValueException(), 'Minimum value must be lesser than maximum value'); } - $validator = new Range($min, $max, Database::VAR_INTEGER); + $validator = new Range($min, $max, Database::VAR_BIGINT); if (!\is_null($default) && !$validator->isValid($default)) { throw new Exception($this->getInvalidValueException(), $validator->getDescription()); } @@ -99,7 +98,7 @@ class Create extends Action $attribute = $this->createAttribute($databaseId, $collectionId, new Document([ 'key' => $key, - 'type' => Database::VAR_INTEGER, + 'type' => Database::VAR_BIGINT, 'size' => $size, 'required' => $required, 'default' => $default, diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php index 4c795527cb..5d8e8bf3a5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php @@ -85,7 +85,7 @@ class Update extends Action dbForProject: $dbForProject, queueForEvents: $queueForEvents, authorization: $authorization, - type: Database::VAR_INTEGER, + type: Database::VAR_BIGINT, default: $default, required: $required, min: $min, diff --git a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php index 9e0d918fe0..2ab02991cb 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php @@ -7,7 +7,7 @@ use Appwrite\Utopia\Response; class AttributeBigInt extends AttributeInteger { public array $conditions = [ - 'type' => self::TYPE_INTEGER, + 'type' => 'bigint', 'size' => 8, ]; diff --git a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php index 9d7649f144..0d8b71ee98 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php @@ -7,7 +7,7 @@ use Appwrite\Utopia\Response; class ColumnBigInt extends ColumnInteger { public array $conditions = [ - 'type' => self::TYPE_INTEGER, + 'type' => 'bigint', 'size' => 8, ]; diff --git a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php index 66f08e6000..614a8f1f34 100644 --- a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php +++ b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php @@ -210,8 +210,7 @@ class DatabasesNumericTypesTest extends Scope $this->assertEquals(200, $bigintColumn['headers']['status-code']); $this->assertEquals('bigint_field', $bigintColumn['body']['key']); - // Some implementations may still represent bigint columns as integer internally. - $this->assertTrue(\in_array($bigintColumn['body']['type'], ['bigint', 'integer'], true)); + $this->assertEquals('bigint', $bigintColumn['body']['type']); $this->assertEquals(false, $bigintColumn['body']['required']); $this->assertEquals(false, $bigintColumn['body']['array']); $this->assertEquals(-900719925, $bigintColumn['body']['min']); @@ -245,7 +244,7 @@ class DatabasesNumericTypesTest extends Scope } $this->assertEquals('integer', $columnTypeByKey['integer_field']); - $this->assertTrue(\in_array($columnTypeByKey['bigint_field'], ['bigint', 'integer'], true)); + $this->assertEquals('bigint', $columnTypeByKey['bigint_field']); } public function testCreateRowWithIntegerAndBigIntTypes(): void From 737bfc599a7b7c467e9798b768ac4b1f4b4f1b98 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 18:00:43 +0530 Subject: [PATCH 11/31] fixed analyze --- tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php index 614a8f1f34..2da7769672 100644 --- a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php +++ b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php @@ -29,8 +29,8 @@ class DatabasesNumericTypesTest extends Scope protected function setupDatabaseAndTable(): array { $cacheKey = $this->getProject()['$id'] ?? 'default'; - if (!empty(static::$setupCache[$cacheKey])) { - return static::$setupCache[$cacheKey]; + if (!empty(self::$setupCache[$cacheKey])) { + return self::$setupCache[$cacheKey]; } $projectId = $this->getProject()['$id']; @@ -82,7 +82,7 @@ class DatabasesNumericTypesTest extends Scope // Cache before waiting so that if waitForAllAttributes times out, // subsequent calls don't try to re-create the same columns (causing 409) - static::$setupCache[$cacheKey] = [ + self::$setupCache[$cacheKey] = [ 'databaseId' => $databaseId, 'tableId' => $tableId, ]; @@ -90,7 +90,7 @@ class DatabasesNumericTypesTest extends Scope // Wait for all columns to be available $this->waitForAllAttributes($databaseId, $tableId); - return static::$setupCache[$cacheKey]; + return self::$setupCache[$cacheKey]; } /** From a5b2021d1e3eef44f32930239b81536a9d2f5189 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 18:17:14 +0530 Subject: [PATCH 12/31] empty From dfbf22cf3cf17f46e3f53d5f36dddfd19f3b5ec6 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 18:36:19 +0530 Subject: [PATCH 13/31] updated format --- app/init/database/formats.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/init/database/formats.php b/app/init/database/formats.php index 29a4f0c7d4..a4d80bea3e 100644 --- a/app/init/database/formats.php +++ b/app/init/database/formats.php @@ -36,6 +36,13 @@ Structure::addFormat(APP_DATABASE_ATTRIBUTE_INT_RANGE, function ($attribute) { return new Range($min, $max, Range::TYPE_INTEGER); }, Database::VAR_INTEGER); +// BigInt uses the same intRange format, but is stored as a 64-bit integer type. +Structure::addFormat(APP_DATABASE_ATTRIBUTE_INT_RANGE, function ($attribute) { + $min = $attribute['formatOptions']['min'] ?? -INF; + $max = $attribute['formatOptions']['max'] ?? INF; + return new Range($min, $max, Range::TYPE_INTEGER); +}, Database::VAR_BIGINT); + Structure::addFormat(APP_DATABASE_ATTRIBUTE_FLOAT_RANGE, function ($attribute) { $min = $attribute['formatOptions']['min'] ?? -INF; $max = $attribute['formatOptions']['max'] ?? INF; From 2fb54e084628468517826203d4b58a7e0593fe75 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 18:59:24 +0530 Subject: [PATCH 14/31] Add BigInt support with dedicated bigintRange format and update related logic --- app/init/constants.php | 1 + app/init/database/formats.php | 4 ++-- .../Databases/Collections/Attributes/Action.php | 14 +++++++++----- .../Collections/Attributes/BigInt/Create.php | 2 +- .../Http/Databases/Collections/Create.php | 14 +++++++++----- tests/e2e/Services/Migrations/MigrationsBase.php | 1 - 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/init/constants.php b/app/init/constants.php index ab88be5854..2aa9a938ab 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -54,6 +54,7 @@ const APP_DATABASE_ATTRIBUTE_IP = 'ip'; const APP_DATABASE_ATTRIBUTE_DATETIME = 'datetime'; const APP_DATABASE_ATTRIBUTE_URL = 'url'; const APP_DATABASE_ATTRIBUTE_INT_RANGE = 'intRange'; +const APP_DATABASE_ATTRIBUTE_BIGINT_RANGE = 'bigintRange'; const APP_DATABASE_ATTRIBUTE_FLOAT_RANGE = 'floatRange'; const APP_DATABASE_ATTRIBUTE_POINT = 'point'; const APP_DATABASE_ATTRIBUTE_LINE = 'line'; diff --git a/app/init/database/formats.php b/app/init/database/formats.php index a4d80bea3e..9ecf07716a 100644 --- a/app/init/database/formats.php +++ b/app/init/database/formats.php @@ -36,8 +36,8 @@ Structure::addFormat(APP_DATABASE_ATTRIBUTE_INT_RANGE, function ($attribute) { return new Range($min, $max, Range::TYPE_INTEGER); }, Database::VAR_INTEGER); -// BigInt uses the same intRange format, but is stored as a 64-bit integer type. -Structure::addFormat(APP_DATABASE_ATTRIBUTE_INT_RANGE, function ($attribute) { +// BigInt uses a dedicated bigintRange format name to avoid clobbering `intRange`. +Structure::addFormat(APP_DATABASE_ATTRIBUTE_BIGINT_RANGE, function ($attribute) { $min = $attribute['formatOptions']['min'] ?? -INF; $max = $attribute['formatOptions']['max'] ?? INF; return new Range($min, $max, Range::TYPE_INTEGER); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index e4c02b40ce..0825f6a48e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -544,6 +544,7 @@ abstract class Action extends UtopiaAction switch ($attribute->getAttribute('format')) { case APP_DATABASE_ATTRIBUTE_INT_RANGE: + case APP_DATABASE_ATTRIBUTE_BIGINT_RANGE: case APP_DATABASE_ATTRIBUTE_FLOAT_RANGE: $min ??= $attribute->getAttribute('formatOptions')['min']; $max ??= $attribute->getAttribute('formatOptions')['max']; @@ -552,16 +553,19 @@ abstract class Action extends UtopiaAction throw new Exception($this->getInvalidValueException(), 'Minimum value must be lesser than maximum value'); } - if ($attribute->getAttribute('format') === APP_DATABASE_ATTRIBUTE_INT_RANGE) { - // Use bigint validator when updating a bigint attribute/column. - $rangeType = $type === Database::VAR_BIGINT ? Database::VAR_BIGINT : Database::VAR_INTEGER; - $validator = new Range($min, $max, $rangeType); - } else { + if ($attribute->getAttribute('format') === APP_DATABASE_ATTRIBUTE_FLOAT_RANGE) { $validator = new Range($min, $max, Database::VAR_FLOAT); if (!is_null($default)) { $default = \floatval($default); } + } else { + // intRange and bigintRange share the same integer range semantics + // but validate against different primitive types. + $rangeType = $attribute->getAttribute('format') === APP_DATABASE_ATTRIBUTE_BIGINT_RANGE + ? Database::VAR_BIGINT + : Database::VAR_INTEGER; + $validator = new Range($min, $max, $rangeType); } if (!is_null($default) && !$validator->isValid($default)) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index a7df055094..74e63e2f2d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -103,7 +103,7 @@ class Create extends Action 'required' => $required, 'default' => $default, 'array' => $array, - 'format' => APP_DATABASE_ATTRIBUTE_INT_RANGE, + 'format' => APP_DATABASE_ATTRIBUTE_BIGINT_RANGE, 'formatOptions' => ['min' => $min, 'max' => $max], ]), $response, $dbForProject, $queueForDatabase, $queueForEvents, $authorization); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index fd309a413c..788222d4be 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -290,13 +290,17 @@ class Create extends Action } if (isset($attribute['min']) || isset($attribute['max'])) { - $format = $type === Database::VAR_INTEGER - ? APP_DATABASE_ATTRIBUTE_INT_RANGE - : APP_DATABASE_ATTRIBUTE_FLOAT_RANGE; + if ($type === Database::VAR_INTEGER) { + $format = APP_DATABASE_ATTRIBUTE_INT_RANGE; + } elseif ($type === Database::VAR_BIGINT) { + $format = APP_DATABASE_ATTRIBUTE_BIGINT_RANGE; + } else { + $format = APP_DATABASE_ATTRIBUTE_FLOAT_RANGE; + } $formatOptions = [ - 'min' => $attribute['min'] ?? ($type === Database::VAR_INTEGER ? \PHP_INT_MIN : -\PHP_FLOAT_MAX), - 'max' => $attribute['max'] ?? ($type === Database::VAR_INTEGER ? \PHP_INT_MAX : \PHP_FLOAT_MAX), + 'min' => $attribute['min'] ?? ($type === Database::VAR_INTEGER || $type === Database::VAR_BIGINT ? \PHP_INT_MIN : -\PHP_FLOAT_MAX), + 'max' => $attribute['max'] ?? ($type === Database::VAR_INTEGER || $type === Database::VAR_BIGINT ? \PHP_INT_MAX : \PHP_FLOAT_MAX), ]; } diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index fef0a6d577..41710252e4 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1256,7 +1256,6 @@ trait MigrationsBase 'max' => 65, 'required' => true, ]); - $this->assertEquals(202, $response['headers']['status-code']); $this->assertEquals($response['body']['key'], 'age'); $this->assertEquals($response['body']['type'], 'integer'); From 5fa4551400f930d1a42d25e45da559c2acceb653 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 20:10:13 +0530 Subject: [PATCH 15/31] Refactor bigint handling in validation and action classes to unify range validation logic --- composer.lock | 8 ++--- .../Collections/Attributes/Action.php | 10 +----- .../Collections/Attributes/BigInt/Create.php | 2 +- .../Utopia/Database/Validator/Attributes.php | 34 ++++++++++++++----- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/composer.lock b/composer.lock index 036415e843..cdc650af86 100644 --- a/composer.lock +++ b/composer.lock @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "ef5c77972a95129eb929cce6c8f7c674db930ec9" + "reference": "b87cf3a9727f24cf080d8d2c21f376b88b308668" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/ef5c77972a95129eb929cce6c8f7c674db930ec9", - "reference": "ef5c77972a95129eb929cce6c8f7c674db930ec9", + "url": "https://api.github.com/repos/utopia-php/database/zipball/b87cf3a9727f24cf080d8d2c21f376b88b308668", + "reference": "b87cf3a9727f24cf080d8d2c21f376b88b308668", "shasum": "" }, "require": { @@ -3905,7 +3905,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-03-30T06:31:05+00:00" + "time": "2026-03-30T14:36:08+00:00" }, { "name": "utopia-php/detector", diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index 0825f6a48e..d726d613be 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -237,10 +237,6 @@ abstract class Action extends UtopiaAction ? UtopiaResponse::MODEL_ATTRIBUTE_BOOLEAN : UtopiaResponse::MODEL_COLUMN_BOOLEAN, - Database::VAR_BIGINT => $isCollections - ? UtopiaResponse::MODEL_ATTRIBUTE_BIGINT - : UtopiaResponse::MODEL_COLUMN_BIGINT, - Database::VAR_INTEGER => $isCollections ? UtopiaResponse::MODEL_ATTRIBUTE_INTEGER : UtopiaResponse::MODEL_COLUMN_INTEGER, @@ -561,11 +557,7 @@ abstract class Action extends UtopiaAction } } else { // intRange and bigintRange share the same integer range semantics - // but validate against different primitive types. - $rangeType = $attribute->getAttribute('format') === APP_DATABASE_ATTRIBUTE_BIGINT_RANGE - ? Database::VAR_BIGINT - : Database::VAR_INTEGER; - $validator = new Range($min, $max, $rangeType); + $validator = new Range($min, $max, Range::TYPE_INTEGER); } if (!is_null($default) && !$validator->isValid($default)) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index 74e63e2f2d..c0544fb122 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -88,7 +88,7 @@ class Create extends Action throw new Exception($this->getInvalidValueException(), 'Minimum value must be lesser than maximum value'); } - $validator = new Range($min, $max, Database::VAR_BIGINT); + $validator = new Range($min, $max, Range::TYPE_INTEGER); if (!\is_null($default) && !$validator->isValid($default)) { throw new Exception($this->getInvalidValueException(), $validator->getDescription()); } diff --git a/src/Appwrite/Utopia/Database/Validator/Attributes.php b/src/Appwrite/Utopia/Database/Validator/Attributes.php index f8bdd01103..34562a2536 100644 --- a/src/Appwrite/Utopia/Database/Validator/Attributes.php +++ b/src/Appwrite/Utopia/Database/Validator/Attributes.php @@ -23,6 +23,7 @@ class Attributes extends Validator protected array $supportedTypes = [ Database::VAR_STRING, Database::VAR_INTEGER, + Database::VAR_BIGINT, Database::VAR_FLOAT, Database::VAR_BOOLEAN, Database::VAR_DATETIME, @@ -181,9 +182,9 @@ class Attributes extends Validator return false; } - // Validate signed only for integer/float types - if (isset($attribute['signed']) && !in_array($attribute['type'], [Database::VAR_INTEGER, Database::VAR_FLOAT])) { - $this->message = "Attribute '" . $attribute['key'] . "': 'signed' can only be used with integer or float types"; + // Validate signed only for integer/bigint/float types + if (isset($attribute['signed']) && !in_array($attribute['type'], [Database::VAR_INTEGER, Database::VAR_BIGINT, Database::VAR_FLOAT])) { + $this->message = "Attribute '" . $attribute['key'] . "': 'signed' can only be used with integer, bigint or float types"; return false; } @@ -199,10 +200,10 @@ class Attributes extends Validator return false; } - // Validate min/max range for integer/float + // Validate min/max range for integer/bigint/float if (isset($attribute['min']) || isset($attribute['max'])) { - if (!in_array($attribute['type'], [Database::VAR_INTEGER, Database::VAR_FLOAT])) { - $this->message = "Attribute '" . $attribute['key'] . "': min/max can only be used with integer or float types"; + if (!in_array($attribute['type'], [Database::VAR_INTEGER, Database::VAR_BIGINT, Database::VAR_FLOAT])) { + $this->message = "Attribute '" . $attribute['key'] . "': min/max can only be used with integer, bigint or float types"; return false; } @@ -264,7 +265,7 @@ class Attributes extends Validator if (isset($attribute['min']) || isset($attribute['max'])) { $min = $attribute['min'] ?? \PHP_INT_MIN; $max = $attribute['max'] ?? \PHP_INT_MAX; - $rangeValidator = new Range($min, $max, Database::VAR_INTEGER); + $rangeValidator = new Range($min, $max, Range::TYPE_INTEGER); if (!$rangeValidator->isValid($attribute['default'])) { $this->message = "Default value for integer attribute '" . $attribute['key'] . "' must be between $min and $max"; return false; @@ -272,6 +273,23 @@ class Attributes extends Validator } break; + case Database::VAR_BIGINT: + if (!is_int($attribute['default'])) { + $this->message = "Default value for bigint attribute '" . $attribute['key'] . "' must be an integer"; + return false; + } + // Validate within range if min/max specified + if (isset($attribute['min']) || isset($attribute['max'])) { + $min = $attribute['min'] ?? \PHP_INT_MIN; + $max = $attribute['max'] ?? \PHP_INT_MAX; + $rangeValidator = new Range($min, $max, Range::TYPE_INTEGER); + if (!$rangeValidator->isValid($attribute['default'])) { + $this->message = "Default value for bigint attribute '" . $attribute['key'] . "' must be between $min and $max"; + return false; + } + } + break; + case Database::VAR_FLOAT: if (!is_float($attribute['default']) && !is_int($attribute['default'])) { $this->message = "Default value for float attribute '" . $attribute['key'] . "' must be a number"; @@ -281,7 +299,7 @@ class Attributes extends Validator if (isset($attribute['min']) || isset($attribute['max'])) { $min = $attribute['min'] ?? -\PHP_FLOAT_MAX; $max = $attribute['max'] ?? \PHP_FLOAT_MAX; - $rangeValidator = new Range($min, $max, Database::VAR_FLOAT); + $rangeValidator = new Range($min, $max, Range::TYPE_FLOAT); if (!$rangeValidator->isValid((float)$attribute['default'])) { $this->message = "Default value for float attribute '" . $attribute['key'] . "' must be between $min and $max"; return false; From c4b3956beff6a28c49c90a37a7b5ab3da53ed9ab Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 20:26:23 +0530 Subject: [PATCH 16/31] emtpy From ad7f83db11b14203583a77867153e2634c3f5b83 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 30 Mar 2026 20:32:03 +0530 Subject: [PATCH 17/31] updated actions --- .../Http/Databases/Collections/Attributes/Action.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index d726d613be..3b28bdeffb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -241,6 +241,10 @@ abstract class Action extends UtopiaAction ? UtopiaResponse::MODEL_ATTRIBUTE_INTEGER : UtopiaResponse::MODEL_COLUMN_INTEGER, + Database::VAR_BIGINT => $isCollections + ? UtopiaResponse::MODEL_ATTRIBUTE_BIGINT + : UtopiaResponse::MODEL_COLUMN_BIGINT, + Database::VAR_FLOAT => $isCollections ? UtopiaResponse::MODEL_ATTRIBUTE_FLOAT : UtopiaResponse::MODEL_COLUMN_FLOAT, From 71b28eae5a7f0bcb44d9ee1e9d80353eb8ab909f Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 1 Apr 2026 15:55:26 +0530 Subject: [PATCH 18/31] updated db --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 59173e9794..869bee8d7d 100644 --- a/composer.lock +++ b/composer.lock @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "b87cf3a9727f24cf080d8d2c21f376b88b308668" + "reference": "ad89dab91d0e85f4496d366ad80b687cbdefd714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/b87cf3a9727f24cf080d8d2c21f376b88b308668", - "reference": "b87cf3a9727f24cf080d8d2c21f376b88b308668", + "url": "https://api.github.com/repos/utopia-php/database/zipball/ad89dab91d0e85f4496d366ad80b687cbdefd714", + "reference": "ad89dab91d0e85f4496d366ad80b687cbdefd714", "shasum": "" }, "require": { @@ -3905,7 +3905,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-03-30T14:36:08+00:00" + "time": "2026-04-01T05:25:04+00:00" }, { "name": "utopia-php/detector", From 45dc259df3d341be3001b0ec8d264742c65f819b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 9 Apr 2026 11:14:28 +0530 Subject: [PATCH 19/31] updated validator --- composer.lock | 8 ++++---- .../Http/TablesDB/Tables/Columns/BigInt/Create.php | 3 ++- .../Http/TablesDB/Tables/Columns/BigInt/Update.php | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 869bee8d7d..a1fa0b153a 100644 --- a/composer.lock +++ b/composer.lock @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "ad89dab91d0e85f4496d366ad80b687cbdefd714" + "reference": "17615116013c18b8f4d00246d52268ffbc15b11c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/ad89dab91d0e85f4496d366ad80b687cbdefd714", - "reference": "ad89dab91d0e85f4496d366ad80b687cbdefd714", + "url": "https://api.github.com/repos/utopia-php/database/zipball/17615116013c18b8f4d00246d52268ffbc15b11c", + "reference": "17615116013c18b8f4d00246d52268ffbc15b11c", "shasum": "" }, "require": { @@ -3905,7 +3905,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-04-01T05:25:04+00:00" + "time": "2026-04-09T05:22:46+00:00" }, { "name": "utopia-php/detector", diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php index 1b7b33291b..2b5dd078b4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php @@ -8,6 +8,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; +use Utopia\Database\Validator\BigInt; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; @@ -58,7 +59,7 @@ class Create extends BigIntCreate ->param('required', null, new Boolean(), 'Is column required?') ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) - ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.', true) + ->param('default', null, new Nullable(new BigInt(false, true)), 'Default value. Cannot be set when column is required.', true) ->param('array', false, new Boolean(), 'Is column an array?', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php index 387dd08238..bcec75f713 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php @@ -9,6 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; +use Utopia\Database\Validator\BigInt; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; @@ -60,7 +61,7 @@ class Update extends BigIntUpdate ->param('required', null, new Boolean(), 'Is column required?') ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) - ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.') + ->param('default', null, new Nullable(new BigInt(false, true)), 'Default value. Cannot be set when column is required.') ->param('newKey', null, fn (Database $dbForProject) => new Nullable(new Key(false, $dbForProject->getAdapter()->getMaxUIDLength())), 'New Column Key.', true, ['dbForProject']) ->inject('response') ->inject('dbForProject') From 0c734f8f1205ae6344382e791b1b303d5781e29f Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 9 Apr 2026 12:02:13 +0530 Subject: [PATCH 20/31] updated --- composer.lock | 36 +++++++++---------- .../SDK/Specification/Format/OpenAPI3.php | 9 +++++ .../SDK/Specification/Format/Swagger2.php | 9 +++++ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 45ced3bce8..141ef45c01 100644 --- a/composer.lock +++ b/composer.lock @@ -3403,16 +3403,16 @@ }, { "name": "utopia-php/agents", - "version": "1.2.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/utopia-php/agents.git", - "reference": "052227953678a30ecc4b5467401fcb0b2386471e" + "reference": "06064fd9fb19b77ae45a12ec7bcbc17670912c30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/agents/zipball/052227953678a30ecc4b5467401fcb0b2386471e", - "reference": "052227953678a30ecc4b5467401fcb0b2386471e", + "url": "https://api.github.com/repos/utopia-php/agents/zipball/06064fd9fb19b77ae45a12ec7bcbc17670912c30", + "reference": "06064fd9fb19b77ae45a12ec7bcbc17670912c30", "shasum": "" }, "require": { @@ -3450,9 +3450,9 @@ ], "support": { "issues": "https://github.com/utopia-php/agents/issues", - "source": "https://github.com/utopia-php/agents/tree/1.2.1" + "source": "https://github.com/utopia-php/agents/tree/1.3.0" }, - "time": "2026-02-24T06:03:55+00:00" + "time": "2026-03-26T03:51:11+00:00" }, { "name": "utopia-php/analytics", @@ -5225,16 +5225,16 @@ }, { "name": "utopia-php/vcs", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "03b76ad5fd01bc50f809915bca6ff0745ea913af" + "reference": "44a84ab52b42fc12f812b4d7331286b519d39db3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/03b76ad5fd01bc50f809915bca6ff0745ea913af", - "reference": "03b76ad5fd01bc50f809915bca6ff0745ea913af", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/44a84ab52b42fc12f812b4d7331286b519d39db3", + "reference": "44a84ab52b42fc12f812b4d7331286b519d39db3", "shasum": "" }, "require": { @@ -5268,9 +5268,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/3.1.0" + "source": "https://github.com/utopia-php/vcs/tree/3.2.0" }, - "time": "2026-03-24T08:49:14+00:00" + "time": "2026-04-08T16:00:31+00:00" }, { "name": "utopia-php/websocket", @@ -5448,16 +5448,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.17.7", + "version": "1.17.8", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "291471d04c3f0e7b9fcc46668a6255a4c0f2947e" + "reference": "b7109e13cec89ed56ad80111973b12646e4eb5f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/291471d04c3f0e7b9fcc46668a6255a4c0f2947e", - "reference": "291471d04c3f0e7b9fcc46668a6255a4c0f2947e", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/b7109e13cec89ed56ad80111973b12646e4eb5f7", + "reference": "b7109e13cec89ed56ad80111973b12646e4eb5f7", "shasum": "" }, "require": { @@ -5493,9 +5493,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.17.7" + "source": "https://github.com/appwrite/sdk-generator/tree/1.17.8" }, - "time": "2026-04-08T08:51:05+00:00" + "time": "2026-04-09T05:08:21+00:00" }, { "name": "brianium/paratest", diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 94e0f831b7..0f3b2568a2 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -431,6 +431,15 @@ class OpenAPI3 extends Format $node['schema']['type'] = $validator->getType(); $node['schema']['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; break; + case \Utopia\Database\Validator\BigInt::class: + // BigInt validator reports Database::VAR_BIGINT, but OpenAPI expects scalar types. + // We expose it as int64 to keep schema consistent with Column/Attribute models. + $node['schema']['type'] = 'integer'; + $node['schema']['format'] = 'int64'; + if (!empty($param['example'])) { + $node['schema']['x-example'] = $param['example']; + } + break; case \Utopia\Validator\Boolean::class: $node['schema']['type'] = $validator->getType(); $node['schema']['x-example'] = ($param['example'] ?? '') ?: false; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 14a18eea2e..f47ca03152 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -435,6 +435,15 @@ class Swagger2 extends Format $node['type'] = $validator->getType(); $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; break; + case \Utopia\Database\Validator\BigInt::class: + // BigInt validator reports Database::VAR_BIGINT, but Swagger expects scalar types. + // We expose it as int64 to keep schema consistent with Column/Attribute models. + $node['type'] = 'integer'; + $node['format'] = 'int64'; + if (!empty($param['example'])) { + $node['x-example'] = $param['example']; + } + break; case \Utopia\Validator\Boolean::class: $node['type'] = $validator->getType(); $node['x-example'] = ($param['example'] ?? '') ?: false; From 0ea83790651e33784aa083ffb5134bb2c782e54c Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 9 Apr 2026 14:11:21 +0530 Subject: [PATCH 21/31] added the changes --- .../Http/TablesDB/Tables/Columns/BigInt/Create.php | 3 +-- .../Http/TablesDB/Tables/Columns/BigInt/Update.php | 3 +-- src/Appwrite/SDK/Specification/Format/Swagger2.php | 9 --------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php index 2b5dd078b4..1b7b33291b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php @@ -8,7 +8,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; -use Utopia\Database\Validator\BigInt; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; @@ -59,7 +58,7 @@ class Create extends BigIntCreate ->param('required', null, new Boolean(), 'Is column required?') ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) - ->param('default', null, new Nullable(new BigInt(false, true)), 'Default value. Cannot be set when column is required.', true) + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.', true) ->param('array', false, new Boolean(), 'Is column an array?', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php index bcec75f713..387dd08238 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php @@ -9,7 +9,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; -use Utopia\Database\Validator\BigInt; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; @@ -61,7 +60,7 @@ class Update extends BigIntUpdate ->param('required', null, new Boolean(), 'Is column required?') ->param('min', null, new Nullable(new Integer(false, 64)), 'Minimum value', true) ->param('max', null, new Nullable(new Integer(false, 64)), 'Maximum value', true) - ->param('default', null, new Nullable(new BigInt(false, true)), 'Default value. Cannot be set when column is required.') + ->param('default', null, new Nullable(new Integer(false, 64)), 'Default value. Cannot be set when column is required.') ->param('newKey', null, fn (Database $dbForProject) => new Nullable(new Key(false, $dbForProject->getAdapter()->getMaxUIDLength())), 'New Column Key.', true, ['dbForProject']) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index f47ca03152..14a18eea2e 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -435,15 +435,6 @@ class Swagger2 extends Format $node['type'] = $validator->getType(); $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; break; - case \Utopia\Database\Validator\BigInt::class: - // BigInt validator reports Database::VAR_BIGINT, but Swagger expects scalar types. - // We expose it as int64 to keep schema consistent with Column/Attribute models. - $node['type'] = 'integer'; - $node['format'] = 'int64'; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; case \Utopia\Validator\Boolean::class: $node['type'] = $validator->getType(); $node['x-example'] = ($param['example'] ?? '') ?: false; From 4f599fc75cb5e8cd75b48b0c9a93ad772fff18e4 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 9 Apr 2026 17:07:47 +0530 Subject: [PATCH 22/31] updated --- composer.lock | 8 +-- .../Collections/Attributes/BigInt/Create.php | 5 +- .../Http/Databases/Collections/Create.php | 11 +++- .../Utopia/Response/Model/AttributeBigInt.php | 51 ++++++++++++++++--- .../Utopia/Response/Model/ColumnBigInt.php | 51 ++++++++++++++++--- 5 files changed, 101 insertions(+), 25 deletions(-) diff --git a/composer.lock b/composer.lock index 141ef45c01..bec82a1a4c 100644 --- a/composer.lock +++ b/composer.lock @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "17615116013c18b8f4d00246d52268ffbc15b11c" + "reference": "0e43fd44f2190da36cac816a17650d697e034507" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/17615116013c18b8f4d00246d52268ffbc15b11c", - "reference": "17615116013c18b8f4d00246d52268ffbc15b11c", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0e43fd44f2190da36cac816a17650d697e034507", + "reference": "0e43fd44f2190da36cac816a17650d697e034507", "shasum": "" }, "require": { @@ -3905,7 +3905,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-04-09T05:22:46+00:00" + "time": "2026-04-09T11:05:50+00:00" }, { "name": "utopia-php/detector", diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index c0544fb122..4ea85b71e6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -93,13 +93,10 @@ class Create extends Action throw new Exception($this->getInvalidValueException(), $validator->getDescription()); } - // `bigint` is always stored as a 64-bit integer. - $size = 8; - $attribute = $this->createAttribute($databaseId, $collectionId, new Document([ 'key' => $key, 'type' => Database::VAR_BIGINT, - 'size' => $size, + 'size' => 8, 'required' => $required, 'default' => $default, 'array' => $array, diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 788222d4be..24cec35eac 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -276,7 +276,16 @@ class Create extends Action ): array { $key = $attribute['key']; $type = $attribute['type']; - $size = $attribute['size'] ?? 0; + switch ($type) { + case Database::VAR_INTEGER: + $size = 4; + break; + case Database::VAR_BIGINT: + $size = 8; + break; + default: + $size = $attribute['size'] ?? 0; + } $required = $attribute['required'] ?? false; $signed = $attribute['signed'] ?? true; $array = $attribute['array'] ?? false; diff --git a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php index 2ab02991cb..722bcedf5a 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php @@ -4,21 +4,56 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; -class AttributeBigInt extends AttributeInteger +class AttributeBigInt extends Attribute { - public array $conditions = [ - 'type' => 'bigint', - 'size' => 8, - ]; - public function __construct() { parent::__construct(); - // Update example for the `type` field - $this->rules['type']['example'] = 'bigint'; + $this + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Attribute Key.', + 'default' => '', + 'example' => 'count', + ]) + ->addRule('type', [ + 'type' => self::TYPE_STRING, + 'description' => 'Attribute type.', + 'default' => '', + 'example' => 'bigint', + ]) + ->addRule('min', [ + 'type' => self::TYPE_INTEGER, + 'format' => 'int64', + 'description' => 'Minimum value to enforce for new documents.', + 'default' => null, + 'required' => false, + 'example' => 1, + ]) + ->addRule('max', [ + 'type' => self::TYPE_INTEGER, + 'format' => 'int64', + 'description' => 'Maximum value to enforce for new documents.', + 'default' => null, + 'required' => false, + 'example' => 10, + ]) + ->addRule('default', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.', + 'default' => null, + 'required' => false, + 'example' => 10, + ]) + ; } + public array $conditions = [ + 'type' => 'bigint', + 'size' => 8, + ]; + public function getName(): string { return 'AttributeBigInt'; diff --git a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php index 0d8b71ee98..c4d7f96586 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php @@ -4,21 +4,56 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; -class ColumnBigInt extends ColumnInteger +class ColumnBigInt extends Column { - public array $conditions = [ - 'type' => 'bigint', - 'size' => 8, - ]; - public function __construct() { parent::__construct(); - // Update example for the `type` field - $this->rules['type']['example'] = 'bigint'; + $this + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Column Key.', + 'default' => '', + 'example' => 'count', + ]) + ->addRule('type', [ + 'type' => self::TYPE_STRING, + 'description' => 'Column type.', + 'default' => '', + 'example' => 'bigint', + ]) + ->addRule('min', [ + 'type' => self::TYPE_INTEGER, + 'format' => 'int64', + 'description' => 'Minimum value to enforce for new documents.', + 'default' => null, + 'required' => false, + 'example' => 1, + ]) + ->addRule('max', [ + 'type' => self::TYPE_INTEGER, + 'format' => 'int64', + 'description' => 'Maximum value to enforce for new documents.', + 'default' => null, + 'required' => false, + 'example' => 10, + ]) + ->addRule('default', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Default value for column when not provided. Cannot be set when column is required.', + 'default' => null, + 'required' => false, + 'example' => 10, + ]) + ; } + public array $conditions = [ + 'type' => 'bigint', + 'size' => 8, + ]; + public function getName(): string { return 'ColumnBigInt'; From b3c6e0e67f19f9c5932bf3e90340e9d35c6a9902 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 9 Apr 2026 17:10:47 +0530 Subject: [PATCH 23/31] removed size from the conditions --- src/Appwrite/Utopia/Response/Model/AttributeBigInt.php | 3 +-- src/Appwrite/Utopia/Response/Model/ColumnBigInt.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php index 722bcedf5a..217589c578 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php @@ -50,8 +50,7 @@ class AttributeBigInt extends Attribute } public array $conditions = [ - 'type' => 'bigint', - 'size' => 8, + 'type' => 'bigint' ]; public function getName(): string diff --git a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php index c4d7f96586..e001b6aedf 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php @@ -50,8 +50,7 @@ class ColumnBigInt extends Column } public array $conditions = [ - 'type' => 'bigint', - 'size' => 8, + 'type' => 'bigint' ]; public function getName(): string From d84f71e728fe9af0b412cf325daafd05d9ed5431 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 16 Apr 2026 14:10:20 +0530 Subject: [PATCH 24/31] updated --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 270491a291..d456c314a3 100644 --- a/composer.lock +++ b/composer.lock @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "7315ba260141830ec1f51963955e12695988c281" + "reference": "6ff2d7b081f99280ffb85dd6efa710c9aeb3e620" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/7315ba260141830ec1f51963955e12695988c281", - "reference": "7315ba260141830ec1f51963955e12695988c281", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6ff2d7b081f99280ffb85dd6efa710c9aeb3e620", + "reference": "6ff2d7b081f99280ffb85dd6efa710c9aeb3e620", "shasum": "" }, "require": { @@ -3905,7 +3905,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-04-16T08:36:02+00:00" + "time": "2026-04-16T08:39:46+00:00" }, { "name": "utopia-php/detector", From e7072574adb5a6035bc207f232bd2141de453ca6 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 16 Apr 2026 14:13:01 +0530 Subject: [PATCH 25/31] updated tests --- .../Http/Databases/Collections/Create.php | 3 --- .../TablesDB/DatabasesNumericTypesTest.php | 18 +++++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 24cec35eac..32c311b10a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -277,9 +277,6 @@ class Create extends Action $key = $attribute['key']; $type = $attribute['type']; switch ($type) { - case Database::VAR_INTEGER: - $size = 4; - break; case Database::VAR_BIGINT: $size = 8; break; diff --git a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php index 2da7769672..0e46d9466c 100644 --- a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php +++ b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php @@ -75,9 +75,9 @@ class DatabasesNumericTypesTest extends Scope $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint', $headers, [ 'key' => 'bigint_field', 'required' => false, - 'min' => -900719925, - 'max' => 900719925, - 'default' => 123, + 'min' => -9007199254740991, + 'max' => 9007199254740991, + 'default' => 9007199254740000, ]); // Cache before waiting so that if waitForAllAttributes times out, @@ -139,9 +139,9 @@ class DatabasesNumericTypesTest extends Scope $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint', $headers, [ 'key' => 'bigint_field', 'required' => false, - 'min' => -900719925, - 'max' => 900719925, - 'default' => 123, + 'min' => -9007199254740991, + 'max' => 9007199254740991, + 'default' => 9007199254740000, ]); $this->waitForAllAttributes($databaseId, $tableId); @@ -213,9 +213,9 @@ class DatabasesNumericTypesTest extends Scope $this->assertEquals('bigint', $bigintColumn['body']['type']); $this->assertEquals(false, $bigintColumn['body']['required']); $this->assertEquals(false, $bigintColumn['body']['array']); - $this->assertEquals(-900719925, $bigintColumn['body']['min']); - $this->assertEquals(900719925, $bigintColumn['body']['max']); - $this->assertEquals(123, $bigintColumn['body']['default']); + $this->assertEquals(-9007199254740991, $bigintColumn['body']['min']); + $this->assertEquals(9007199254740991, $bigintColumn['body']['max']); + $this->assertEquals(9007199254740000, $bigintColumn['body']['default']); } public function testListColumnsWithNumericTypes(): void From 90e681a9066da41177dd9a2211cee4c126df2069 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 5 May 2026 19:20:47 +0530 Subject: [PATCH 26/31] updated --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index d8c19b75ac..eb6212a620 100644 --- a/composer.lock +++ b/composer.lock @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "dd1077a1548a2a0a07469181e3421f35e27daf3b" + "reference": "ee8895a3ae835978fa4eb143619e4950e7001648" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/dd1077a1548a2a0a07469181e3421f35e27daf3b", - "reference": "dd1077a1548a2a0a07469181e3421f35e27daf3b", + "url": "https://api.github.com/repos/utopia-php/database/zipball/ee8895a3ae835978fa4eb143619e4950e7001648", + "reference": "ee8895a3ae835978fa4eb143619e4950e7001648", "shasum": "" }, "require": { @@ -3906,7 +3906,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/big-init" }, - "time": "2026-05-05T13:22:35+00:00" + "time": "2026-05-05T13:27:52+00:00" }, { "name": "utopia-php/detector", From 57dd7cf95229157828398adb06e6f428e79d999b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 5 May 2026 19:22:00 +0530 Subject: [PATCH 27/31] updated --- src/Appwrite/Utopia/Response/Model/AttributeBigInt.php | 1 + src/Appwrite/Utopia/Response/Model/ColumnBigInt.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php index 217589c578..baa93ff103 100644 --- a/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/AttributeBigInt.php @@ -41,6 +41,7 @@ class AttributeBigInt extends Attribute ]) ->addRule('default', [ 'type' => self::TYPE_INTEGER, + 'format' => 'int64', 'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.', 'default' => null, 'required' => false, diff --git a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php index e001b6aedf..895356dbf2 100644 --- a/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php +++ b/src/Appwrite/Utopia/Response/Model/ColumnBigInt.php @@ -41,6 +41,7 @@ class ColumnBigInt extends Column ]) ->addRule('default', [ 'type' => self::TYPE_INTEGER, + 'format' => 'int64', 'description' => 'Default value for column when not provided. Cannot be set when column is required.', 'default' => null, 'required' => false, From 7ccf2b1a1e5f70915dd4083ebe0105e5c5475127 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 5 May 2026 19:28:28 +0530 Subject: [PATCH 28/31] updated --- .../Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php | 2 +- .../Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php index 1b7b33291b..1d32c6bad9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php @@ -34,7 +34,7 @@ class Create extends BigIntCreate ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/columns/bigint') ->desc('Create bigint column') ->groups(['api', 'database', 'schema']) - ->label('scope', ['tables.write', 'collections.write']) + ->label('scope', ['tables.write', 'collections.write', 'columns.write', 'attributes.write']) ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php index 387dd08238..b2754a2b7d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php @@ -35,7 +35,7 @@ class Update extends BigIntUpdate ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/columns/bigint/:key') ->desc('Update bigint column') ->groups(['api', 'database', 'schema']) - ->label('scope', ['tables.write', 'collections.write']) + ->label('scope', ['tables.write', 'collections.write', 'columns.write', 'attributes.write']) ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') From 03f7b62ff1a18a5adf3da1848af8d1eed1dbbe11 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 6 May 2026 11:24:22 +0530 Subject: [PATCH 29/31] refactor: update database version constraints and simplify bigint handling in collection creation Co-authored-by: Copilot --- composer.json | 4 +- composer.lock | 41 ++++++++----------- .../Http/Databases/Collections/Create.php | 20 +++------ 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/composer.json b/composer.json index f9c1072108..0138ad4f57 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", - "utopia-php/database": "dev-big-init as 5.7", + "utopia-php/database": "5.*", "utopia-php/agents": "1.*", "utopia-php/detector": "0.2.*", "utopia-php/domains": "1.*", @@ -74,7 +74,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.22.*", - "utopia-php/migration": "1.9.*", + "utopia-php/migration": "1.*", "utopia-php/platform": "0.13.*", "utopia-php/pools": "1.*", "utopia-php/span": "1.1.*", diff --git a/composer.lock b/composer.lock index eb6212a620..9b88cedefc 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "29610e3ef365af01d018077f2638ffb3", + "content-hash": "4440b62bc2eb25841157914c2b91b087", "packages": [ { "name": "adhocore/jwt", @@ -3850,16 +3850,16 @@ }, { "name": "utopia-php/database", - "version": "dev-big-init", + "version": "5.7.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "ee8895a3ae835978fa4eb143619e4950e7001648" + "reference": "eb35e68f7f90932d5a60bd72e70158ae7a4e0511" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/ee8895a3ae835978fa4eb143619e4950e7001648", - "reference": "ee8895a3ae835978fa4eb143619e4950e7001648", + "url": "https://api.github.com/repos/utopia-php/database/zipball/eb35e68f7f90932d5a60bd72e70158ae7a4e0511", + "reference": "eb35e68f7f90932d5a60bd72e70158ae7a4e0511", "shasum": "" }, "require": { @@ -3904,9 +3904,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/big-init" + "source": "https://github.com/utopia-php/database/tree/5.7.0" }, - "time": "2026-05-05T13:27:52+00:00" + "time": "2026-05-06T01:04:08+00:00" }, { "name": "utopia-php/detector", @@ -4531,16 +4531,16 @@ }, { "name": "utopia-php/migration", - "version": "1.9.6", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "b164631404ec759f8c368fe2321f44c22bc258ab" + "reference": "55f4863d690e775f44fec3cae4bd1f4491fed5ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/b164631404ec759f8c368fe2321f44c22bc258ab", - "reference": "b164631404ec759f8c368fe2321f44c22bc258ab", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/55f4863d690e775f44fec3cae4bd1f4491fed5ea", + "reference": "55f4863d690e775f44fec3cae4bd1f4491fed5ea", "shasum": "" }, "require": { @@ -4549,7 +4549,7 @@ "ext-openssl": "*", "halaxa/json-machine": "^1.2", "php": ">=8.1", - "utopia-php/database": "dev-big-init as 5.4", + "utopia-php/database": "5.*", "utopia-php/dsn": "0.2.*", "utopia-php/storage": "2.*" }, @@ -4580,9 +4580,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.9.6" + "source": "https://github.com/utopia-php/migration/tree/1.10.0" }, - "time": "2026-04-30T08:11:07+00:00" + "time": "2026-05-06T04:35:32+00:00" }, { "name": "utopia-php/mongo", @@ -8444,18 +8444,9 @@ "time": "2024-11-07T12:36:22+00:00" } ], - "aliases": [ - { - "package": "utopia-php/database", - "version": "dev-big-init", - "alias": "5.7", - "alias_normalized": "5.7.0.0" - } - ], + "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "utopia-php/database": 20 - }, + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 32c311b10a..3a53a49579 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -276,13 +276,7 @@ class Create extends Action ): array { $key = $attribute['key']; $type = $attribute['type']; - switch ($type) { - case Database::VAR_BIGINT: - $size = 8; - break; - default: - $size = $attribute['size'] ?? 0; - } + $size = $attribute['size'] ?? 0; $required = $attribute['required'] ?? false; $signed = $attribute['signed'] ?? true; $array = $attribute['array'] ?? false; @@ -296,13 +290,11 @@ class Create extends Action } if (isset($attribute['min']) || isset($attribute['max'])) { - if ($type === Database::VAR_INTEGER) { - $format = APP_DATABASE_ATTRIBUTE_INT_RANGE; - } elseif ($type === Database::VAR_BIGINT) { - $format = APP_DATABASE_ATTRIBUTE_BIGINT_RANGE; - } else { - $format = APP_DATABASE_ATTRIBUTE_FLOAT_RANGE; - } + $format = match($type) { + Database::VAR_INTEGER => APP_DATABASE_ATTRIBUTE_INT_RANGE, + Database::VAR_BIGINT => APP_DATABASE_ATTRIBUTE_BIGINT_RANGE, + default => APP_DATABASE_ATTRIBUTE_FLOAT_RANGE, + }; $formatOptions = [ 'min' => $attribute['min'] ?? ($type === Database::VAR_INTEGER || $type === Database::VAR_BIGINT ? \PHP_INT_MIN : -\PHP_FLOAT_MAX), From 93ce542d31b370208988015cb2beb0c429e9dc5d Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 6 May 2026 11:37:05 +0530 Subject: [PATCH 30/31] updated composer --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 0138ad4f57..dac5be561f 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,7 @@ "appwrite/php-runtimes": "0.20.*", "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "1.2.*", + "utopia-php/agents": "1.2.*", "utopia-php/analytics": "0.15.*", "utopia-php/audit": "2.2.*", "utopia-php/auth": "0.5.*", @@ -61,7 +62,6 @@ "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", "utopia-php/database": "5.*", - "utopia-php/agents": "1.*", "utopia-php/detector": "0.2.*", "utopia-php/domains": "1.*", "utopia-php/emails": "0.6.*", diff --git a/composer.lock b/composer.lock index 9b88cedefc..64c703cf2d 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "4440b62bc2eb25841157914c2b91b087", + "content-hash": "67c7d160c4a122b14eaa235d2417ea60", "packages": [ { "name": "adhocore/jwt", @@ -3403,16 +3403,16 @@ }, { "name": "utopia-php/agents", - "version": "1.3.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/agents.git", - "reference": "06064fd9fb19b77ae45a12ec7bcbc17670912c30" + "reference": "052227953678a30ecc4b5467401fcb0b2386471e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/agents/zipball/06064fd9fb19b77ae45a12ec7bcbc17670912c30", - "reference": "06064fd9fb19b77ae45a12ec7bcbc17670912c30", + "url": "https://api.github.com/repos/utopia-php/agents/zipball/052227953678a30ecc4b5467401fcb0b2386471e", + "reference": "052227953678a30ecc4b5467401fcb0b2386471e", "shasum": "" }, "require": { @@ -3450,9 +3450,9 @@ ], "support": { "issues": "https://github.com/utopia-php/agents/issues", - "source": "https://github.com/utopia-php/agents/tree/1.3.0" + "source": "https://github.com/utopia-php/agents/tree/1.2.1" }, - "time": "2026-03-26T03:51:11+00:00" + "time": "2026-02-24T06:03:55+00:00" }, { "name": "utopia-php/analytics", From fc918d8b3c3945a8a1223e7a663c759e7960e71f Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 6 May 2026 11:48:47 +0530 Subject: [PATCH 31/31] feat: add support for unsigned integer and bigint columns in database tests Co-authored-by: Copilot --- .../TablesDB/DatabasesNumericTypesTest.php | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php index 0e46d9466c..4280bfece9 100644 --- a/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php +++ b/tests/e2e/Services/TablesDB/DatabasesNumericTypesTest.php @@ -80,6 +80,26 @@ class DatabasesNumericTypesTest extends Scope 'default' => 9007199254740000, ]); + // Create unsigned integer column + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer', $headers, [ + 'key' => 'unsigned_int_field', + 'required' => false, + 'min' => 0, + 'max' => 100, + 'default' => 0, + 'signed' => false, + ]); + + // Create unsigned bigint column + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint', $headers, [ + 'key' => 'unsigned_bigint_field', + 'required' => false, + 'min' => 0, + 'max' => 9223372036854775807, + 'default' => 0, + 'signed' => false, + ]); + // Cache before waiting so that if waitForAllAttributes times out, // subsequent calls don't try to re-create the same columns (causing 409) self::$setupCache[$cacheKey] = [ @@ -144,6 +164,22 @@ class DatabasesNumericTypesTest extends Scope 'default' => 9007199254740000, ]); + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/integer', $headers, [ + 'key' => 'unsigned_int_field', + 'required' => false, + 'max' => 100, + 'default' => 0, + 'signed' => false, + ]); + + $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/bigint', $headers, [ + 'key' => 'unsigned_bigint_field', + 'required' => false, + 'max' => 9223372036854775807, + 'default' => 0, + 'signed' => false, + ]); + $this->waitForAllAttributes($databaseId, $tableId); return [ @@ -218,6 +254,45 @@ class DatabasesNumericTypesTest extends Scope $this->assertEquals(9007199254740000, $bigintColumn['body']['default']); } + public function testGetUnsignedIntegerAndBigIntColumns(): void + { + $data = $this->setupDatabaseAndTable(); + $databaseId = $data['databaseId']; + $tableId = $data['tableId']; + + $unsignedIntColumn = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/unsigned_int_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $unsignedIntColumn['headers']['status-code']); + $this->assertEquals('unsigned_int_field', $unsignedIntColumn['body']['key']); + $this->assertEquals('integer', $unsignedIntColumn['body']['type']); + $this->assertEquals(false, $unsignedIntColumn['body']['required']); + $this->assertEquals(false, $unsignedIntColumn['body']['array']); + $this->assertEquals(false, $unsignedIntColumn['body']['signed']); + $this->assertEquals(0, $unsignedIntColumn['body']['min']); + $this->assertEquals(100, $unsignedIntColumn['body']['max']); + $this->assertEquals(0, $unsignedIntColumn['body']['default']); + + $unsignedBigintColumn = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/columns/unsigned_bigint_field', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $unsignedBigintColumn['headers']['status-code']); + $this->assertEquals('unsigned_bigint_field', $unsignedBigintColumn['body']['key']); + $this->assertEquals('bigint', $unsignedBigintColumn['body']['type']); + $this->assertEquals(false, $unsignedBigintColumn['body']['required']); + $this->assertEquals(false, $unsignedBigintColumn['body']['array']); + $this->assertEquals(false, $unsignedBigintColumn['body']['signed']); + $this->assertEquals(0, $unsignedBigintColumn['body']['min']); + $this->assertEquals(9223372036854775807, $unsignedBigintColumn['body']['max']); + $this->assertEquals(0, $unsignedBigintColumn['body']['default']); + } + public function testListColumnsWithNumericTypes(): void { $data = $this->setupDatabaseAndTable(); @@ -237,6 +312,8 @@ class DatabasesNumericTypesTest extends Scope $columnKeys = array_map(fn ($col) => $col['key'], $columns['body']['columns']); $this->assertContains('integer_field', $columnKeys); $this->assertContains('bigint_field', $columnKeys); + $this->assertContains('unsigned_int_field', $columnKeys); + $this->assertContains('unsigned_bigint_field', $columnKeys); $columnTypeByKey = []; foreach ($columns['body']['columns'] as $col) { @@ -245,6 +322,8 @@ class DatabasesNumericTypesTest extends Scope $this->assertEquals('integer', $columnTypeByKey['integer_field']); $this->assertEquals('bigint', $columnTypeByKey['bigint_field']); + $this->assertEquals('integer', $columnTypeByKey['unsigned_int_field']); + $this->assertEquals('bigint', $columnTypeByKey['unsigned_bigint_field']); } public function testCreateRowWithIntegerAndBigIntTypes(): void @@ -262,6 +341,8 @@ class DatabasesNumericTypesTest extends Scope 'data' => [ 'integer_field' => 5, 'bigint_field' => 456, + 'unsigned_int_field' => 50, + 'unsigned_bigint_field' => 9007199254740000, ], 'permissions' => [ Permission::read(Role::any()), @@ -271,6 +352,8 @@ class DatabasesNumericTypesTest extends Scope $this->assertEquals(201, $row['headers']['status-code']); $this->assertEquals(5, $row['body']['integer_field']); $this->assertEquals(456, $row['body']['bigint_field']); + $this->assertEquals(50, $row['body']['unsigned_int_field']); + $this->assertEquals(9007199254740000, $row['body']['unsigned_bigint_field']); } public function testUpdateIntegerAndBigIntColumns(): void