From a50c23fdaf1198cd428969af67913cce4082913e Mon Sep 17 00:00:00 2001 From: David Kurka Date: Fri, 1 Nov 2024 11:50:12 +0100 Subject: [PATCH] fix: max string length resolution in AbstractPlatform::getEnumDeclarationSQL() --- src/Platforms/AbstractPlatform.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 53b71a8dcd..d11e364eda 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -209,7 +209,11 @@ public function getEnumDeclarationSQL(array $column): string throw ColumnValuesRequired::new($this, 'ENUM'); } - return $this->getStringTypeDeclarationSQL(['length' => max(...array_map(mb_strlen(...), $column['values']))]); + $length = count($column['values']) > 1 + ? max(...array_map(mb_strlen(...), $column['values'])) + : mb_strlen($column['values'][key($column['values'])]); + + return $this->getStringTypeDeclarationSQL(['length' => $length]); } /**