Skip to content

Commit b5c3b35

Browse files
replaced hard coded char limit for the sql column with the max index length
1 parent cefaa83 commit b5c3b35

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/Database/Adapter/MariaDB.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ protected function getSQLType(string $type, int $size, bool $signed = true, bool
19221922
switch ($type) {
19231923
case Database::VAR_STRING:
19241924
// $size = $size * 4; // Convert utf8mb4 size to bytes
1925-
if ($size > 767) {
1925+
if ($size > $this->getMaxIndexLength()) {
19261926
return 'LONGTEXT';
19271927
}
19281928
return "VARCHAR({$size})";

src/Database/Adapter/SQL.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,8 +1575,7 @@ public function getHostname(): string
15751575
public function getMaxVarcharLength(): int
15761576
{
15771577
// Floor value for Postgres:16383 | MySQL:16381 | MariaDB:16382
1578-
// new max value is 767 which will be longtext
1579-
return 767;
1578+
return $this->getMaxIndexLength();
15801579
}
15811580

15821581
/**

0 commit comments

Comments
 (0)