Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
af321ee
Implement BIGINT support across database adapters and add getLimitFor…
ArnabChatterjee20k Mar 27, 2026
3137084
Add support for VAR_BIGINT in Database and Attribute classes
ArnabChatterjee20k Mar 27, 2026
b5c7447
Add tests for BIGINT attribute handling and validation limits
ArnabChatterjee20k Mar 27, 2026
bd14576
Update getLimitForBigInt method to return 4294967295 for Mongo and SQ…
ArnabChatterjee20k Mar 27, 2026
acfeae1
updated bigint mongo
ArnabChatterjee20k Mar 27, 2026
07358a5
Enhance BIGINT handling in MariaDB and SQL adapters
ArnabChatterjee20k Mar 27, 2026
909d8a5
Add VAR_BIGINT to Database class attribute types
ArnabChatterjee20k Mar 27, 2026
f2acd8c
Enhance BIGINT size limit validation in Database class
ArnabChatterjee20k Mar 27, 2026
602eefc
Refine BIGINT handling in Structure and Filter validators
ArnabChatterjee20k Mar 27, 2026
14828d9
Refine BIGINT type determination in Postgres adapter
ArnabChatterjee20k Mar 27, 2026
080de0e
Remove BIGINT size limit validation from Database and Validator classes
ArnabChatterjee20k Mar 30, 2026
73e917e
Add support for VAR_BIGINT in Database class and corresponding tests
ArnabChatterjee20k Mar 30, 2026
ef5c779
updated tests
ArnabChatterjee20k Mar 30, 2026
4490a49
big int validator for attribute
ArnabChatterjee20k Mar 30, 2026
4c5aeb1
updated
ArnabChatterjee20k Mar 30, 2026
8137486
updated attribute validator
ArnabChatterjee20k Mar 30, 2026
b87cf3a
updated
ArnabChatterjee20k Mar 30, 2026
ad89dab
Merge remote-tracking branch 'origin/main' into big-init
ArnabChatterjee20k Apr 1, 2026
5ee5d1b
Add support for unsigned big integers in database adapters and valida…
ArnabChatterjee20k Apr 8, 2026
38e31f4
updated
ArnabChatterjee20k Apr 8, 2026
cafb353
updated
ArnabChatterjee20k Apr 8, 2026
dbe3537
Refactor attribute size handling in database adapters to support both…
ArnabChatterjee20k Apr 8, 2026
ba45e22
Enhance attribute validation to support string type for big integers
ArnabChatterjee20k Apr 8, 2026
75a7f28
Refactor attribute size handling to enforce integer type across datab…
ArnabChatterjee20k Apr 8, 2026
946b841
updated
ArnabChatterjee20k Apr 8, 2026
fafacee
updated
ArnabChatterjee20k Apr 8, 2026
fe3bf72
updated
ArnabChatterjee20k Apr 8, 2026
d3282bc
updated
ArnabChatterjee20k Apr 8, 2026
1761511
updated the type for big int validator
ArnabChatterjee20k Apr 9, 2026
0e43fd4
updated
ArnabChatterjee20k Apr 9, 2026
9c3defb
fix: align bigint handling and validator refactors from PR feedback
Copilot Apr 16, 2026
ae10b94
fix: keep filter supportForAttributes mutability unchanged
Copilot Apr 16, 2026
a58547e
refactor: centralize bigint size normalization and extend coverage
Copilot Apr 16, 2026
7315ba2
fixed the attribute ordering
ArnabChatterjee20k Apr 16, 2026
6ff2d7b
updated
ArnabChatterjee20k Apr 16, 2026
602f0cd
updated
ArnabChatterjee20k Apr 16, 2026
89013ff
updated pool
ArnabChatterjee20k Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Database/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,13 @@ abstract public function getLimitForString(): int;
*/
abstract public function getLimitForInt(): int;

/**
* Get max BIGINT limit
*
* @return int
*/
abstract public function getLimitForBigInt(): int;

/**
* Get maximum attributes limit.
*
Expand Down Expand Up @@ -1442,6 +1449,11 @@ abstract public function decodeLinestring(string $wkb): array;
*/
abstract public function decodePolygon(string $wkb): array;

public function getSupportForUnsignedBigInt(): bool
{
return false;
}

/**
* Returns the document after casting
* @param Document $collection
Expand Down
11 changes: 10 additions & 1 deletion src/Database/Adapter/MariaDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,10 @@ protected function getSQLType(string $type, int $size, bool $signed = true, bool

return 'INT' . $signed;

case Database::VAR_BIGINT:
$signed = ($signed) ? '' : ' UNSIGNED';
return 'BIGINT' . $signed;

case Database::VAR_FLOAT:
$signed = ($signed) ? '' : ' UNSIGNED';
return 'DOUBLE' . $signed;
Expand All @@ -1748,7 +1752,7 @@ protected function getSQLType(string $type, int $size, bool $signed = true, bool
return 'DATETIME(3)';

default:
throw new DatabaseException('Unknown type: ' . $type . '. Must be one of ' . Database::VAR_STRING . ', ' . Database::VAR_VARCHAR . ', ' . Database::VAR_TEXT . ', ' . Database::VAR_MEDIUMTEXT . ', ' . Database::VAR_LONGTEXT . ', ' . Database::VAR_INTEGER . ', ' . Database::VAR_FLOAT . ', ' . Database::VAR_BOOLEAN . ', ' . Database::VAR_DATETIME . ', ' . Database::VAR_RELATIONSHIP . ', ' . Database::VAR_POINT . ', ' . Database::VAR_LINESTRING . ', ' . Database::VAR_POLYGON);
throw new DatabaseException('Unknown type: ' . $type . '. Must be one of ' . Database::VAR_STRING . ', ' . Database::VAR_VARCHAR . ', ' . Database::VAR_TEXT . ', ' . Database::VAR_MEDIUMTEXT . ', ' . Database::VAR_LONGTEXT . ', ' . Database::VAR_INTEGER . ', ' . Database::VAR_BIGINT . ', ' . Database::VAR_FLOAT . ', ' . Database::VAR_BOOLEAN . ', ' . Database::VAR_DATETIME . ', ' . Database::VAR_RELATIONSHIP . ', ' . Database::VAR_POINT . ', ' . Database::VAR_LINESTRING . ', ' . Database::VAR_POLYGON);
}
}

Expand Down Expand Up @@ -2251,6 +2255,11 @@ public function getSupportForObject(): bool
return false;
}

public function getSupportForUnsignedBigInt(): bool
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mongodb, postgresql, sqlite doesn't support unsigned bigint

{
return true;
}

/**
* Are object (JSON) indexes supported?
*
Expand Down
12 changes: 12 additions & 0 deletions src/Database/Adapter/Mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ public function castingAfter(Document $collection, Document $document): Document
foreach ($value as &$node) {
switch ($type) {
case Database::VAR_INTEGER:
case Database::VAR_BIGINT:
$node = (int)$node;
break;
Comment thread
abnegate marked this conversation as resolved.
case Database::VAR_DATETIME:
Expand Down Expand Up @@ -2220,6 +2221,7 @@ private function getMongoTypeCode(string $appwriteType): string
Database::VAR_MEDIUMTEXT => 'string',
Database::VAR_LONGTEXT => 'string',
Database::VAR_INTEGER => 'int',
Database::VAR_BIGINT => 'long',
Database::VAR_FLOAT => 'double',
Database::VAR_BOOLEAN => 'bool',
Database::VAR_DATETIME => 'date',
Expand Down Expand Up @@ -3013,6 +3015,16 @@ public function getLimitForInt(): int
return 4294967295;
}

/**
* Get max BIGINT limit
*
* @return int
*/
public function getLimitForBigInt(): int
{
return Database::MAX_BIG_INT;
}

/**
* Get maximum column limit.
* Returns 0 to indicate no limit
Expand Down
10 changes: 10 additions & 0 deletions src/Database/Adapter/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,16 @@ public function getLimitForInt(): int
return $this->delegate(__FUNCTION__, \func_get_args());
}

public function getLimitForBigInt(): int
{
return $this->delegate(__FUNCTION__, \func_get_args());
}
Comment on lines +336 to +339
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Missing getSupportForUnsignedBigInt() delegation in Pool

Pool inherits getSupportForUnsignedBigInt() from Adapter (which returns false) instead of delegating to the wrapped adapter. In production, Pool is a common way to use MariaDB — but with this bug, Database::getSupportForUnsignedBigInt() always returns false on a Pool-wrapped MariaDB, so Structure, Filter, and attribute validators all clamp the unsigned bigint range to SIGNED_MAX (9,223,372,036,854,775,807). Any value in (PHP_INT_MAX, 18,446,744,073,709,551,615] is rejected at the PHP layer even though MariaDB can store it.

Add the delegation alongside the existing getLimitForBigInt() entry:

Suggested change
public function getLimitForBigInt(): int
{
return $this->delegate(__FUNCTION__, \func_get_args());
}
public function getLimitForBigInt(): int
{
return $this->delegate(__FUNCTION__, \func_get_args());
}
public function getSupportForUnsignedBigInt(): bool
{
return $this->delegate(__FUNCTION__, \func_get_args());
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


public function getSupportForUnsignedBigInt(): bool
{
return $this->delegate(__FUNCTION__, \func_get_args());
}

public function getLimitForAttributes(): int
{
return $this->delegate(__FUNCTION__, \func_get_args());
Expand Down
5 changes: 4 additions & 1 deletion src/Database/Adapter/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,9 @@ protected function getSQLType(string $type, int $size, bool $signed = true, bool

return 'INTEGER';

case Database::VAR_BIGINT:
return 'BIGINT';

case Database::VAR_FLOAT:
return 'DOUBLE PRECISION';

Expand Down Expand Up @@ -2000,7 +2003,7 @@ protected function getSQLType(string $type, int $size, bool $signed = true, bool
return "VECTOR({$size})";

default:
throw new DatabaseException('Unknown Type: ' . $type . '. Must be one of ' . Database::VAR_STRING . ', ' . Database::VAR_VARCHAR . ', ' . Database::VAR_TEXT . ', ' . Database::VAR_MEDIUMTEXT . ', ' . Database::VAR_LONGTEXT . ', ' . Database::VAR_INTEGER . ', ' . Database::VAR_FLOAT . ', ' . Database::VAR_BOOLEAN . ', ' . Database::VAR_DATETIME . ', ' . Database::VAR_RELATIONSHIP . ', ' . Database::VAR_OBJECT . ', ' . Database::VAR_POINT . ', ' . Database::VAR_LINESTRING . ', ' . Database::VAR_POLYGON);
throw new DatabaseException('Unknown Type: ' . $type . '. Must be one of ' . Database::VAR_STRING . ', ' . Database::VAR_VARCHAR . ', ' . Database::VAR_TEXT . ', ' . Database::VAR_MEDIUMTEXT . ', ' . Database::VAR_LONGTEXT . ', ' . Database::VAR_INTEGER . ', ' . Database::VAR_BIGINT . ', ' . Database::VAR_FLOAT . ', ' . Database::VAR_BOOLEAN . ', ' . Database::VAR_DATETIME . ', ' . Database::VAR_RELATIONSHIP . ', ' . Database::VAR_OBJECT . ', ' . Database::VAR_POINT . ', ' . Database::VAR_LINESTRING . ', ' . Database::VAR_POLYGON);
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/Database/Adapter/SQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,16 @@ public function getLimitForInt(): int
return 4294967295;
}

/**
* Get max BIGINT limit
*
* @return int
*/
public function getLimitForBigInt(): int
{
return Database::MAX_BIG_INT;
Copy link
Copy Markdown
Contributor Author

@ArnabChatterjee20k ArnabChatterjee20k Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here going other way around
It is the signed big int limit(supported by all adapter)
For adapters supporting unsigned int, in the attribute validator, we are validating via string comparison

}
Comment thread
ArnabChatterjee20k marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

/**
* Get maximum column limit.
* https://mariadb.com/kb/en/innodb-limitations/#limitations-on-schema
Expand Down Expand Up @@ -1164,6 +1174,10 @@ public function getAttributeWidth(Document $collection): int
}
break;

case Database::VAR_BIGINT:
$total += 8; // BIGINT 8 bytes
break;

case Database::VAR_FLOAT:
$total += 8; // DOUBLE 8 bytes
break;
Expand Down
5 changes: 5 additions & 0 deletions src/Database/Adapter/SQLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,11 @@ public function getSupportForObject(): bool
return false;
}

public function getSupportForUnsignedBigInt(): bool
{
return false;
}

/**
* Are object (JSON) indexes supported?
*
Expand Down
Loading
Loading