From f4c54c20567410dc9a2975dbc857f362bf698014 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 3 Feb 2026 23:00:35 +1300 Subject: [PATCH] Add new string types to valdiation --- src/Database/Database.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Database/Database.php b/src/Database/Database.php index c78b1ae13..d07205505 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -2666,6 +2666,22 @@ public function updateAttribute(string $collection, string $id, ?string $type = } break; + case self::VAR_VARCHAR: + if (empty($size)) { + throw new DatabaseException('Size length is required'); + } + + if ($size > $this->adapter->getMaxVarcharLength()) { + throw new DatabaseException('Max size allowed for varchar is: ' . number_format($this->adapter->getMaxVarcharLength())); + } + break; + + case self::VAR_TEXT: + case self::VAR_MEDIUMTEXT: + case self::VAR_LONGTEXT: + // Text types don't require size validation as they have fixed max sizes + break; + case self::VAR_INTEGER: $limit = ($signed) ? $this->adapter->getLimitForInt() / 2 : $this->adapter->getLimitForInt(); if ($size > $limit) { @@ -2733,6 +2749,10 @@ public function updateAttribute(string $collection, string $id, ?string $type = default: $supportedTypes = [ self::VAR_STRING, + self::VAR_VARCHAR, + self::VAR_TEXT, + self::VAR_MEDIUMTEXT, + self::VAR_LONGTEXT, self::VAR_INTEGER, self::VAR_FLOAT, self::VAR_BOOLEAN,