Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
11 changes: 1 addition & 10 deletions src/Database/Adapter/MariaDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1922,18 +1922,9 @@ protected function getSQLType(string $type, int $size, bool $signed = true, bool
switch ($type) {
case Database::VAR_STRING:
// $size = $size * 4; // Convert utf8mb4 size to bytes
if ($size > 16777215) {
if ($size > 767) {
Comment thread
ArnabChatterjee20k marked this conversation as resolved.
Outdated
return 'LONGTEXT';
}

if ($size > 65535) {
return 'MEDIUMTEXT';
}

if ($size > $this->getMaxVarcharLength()) {
return 'TEXT';
}

return "VARCHAR({$size})";
Comment thread
ArnabChatterjee20k marked this conversation as resolved.
Outdated

case Database::VAR_INTEGER: // We don't support zerofill: https://stackoverflow.com/a/5634147/2299554
Expand Down
4 changes: 3 additions & 1 deletion src/Database/Adapter/SQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,9 @@ public function getHostname(): string
*/
public function getMaxVarcharLength(): int
{
return 16381; // Floor value for Postgres:16383 | MySQL:16381 | MariaDB:16382
// Floor value for Postgres:16383 | MySQL:16381 | MariaDB:16382
// new max value is 767 which will be longtext
return 767;
Comment thread
ArnabChatterjee20k marked this conversation as resolved.
Outdated
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/Adapter/Scopes/CollectionTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ public function testSchemaAttributes(): void

$attribute = $attributes['story'];
$this->assertEquals('story', $attribute['$id']);
$this->assertEquals('text', $attribute['dataType']);
$this->assertEquals('text', $attribute['columnType']);
$this->assertEquals('65535', $attribute['characterMaximumLength']);
$this->assertEquals('longtext', $attribute['dataType']);
$this->assertEquals('longtext', $attribute['columnType']);
$this->assertEquals('4294967295', $attribute['characterMaximumLength']);

$attribute = $attributes['string_list'];
$this->assertEquals('string_list', $attribute['$id']);
Expand Down