From 7cf5ba2c667086ca39474fcb7ea895e148a922e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 15 Aug 2025 23:22:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=20longtext=20?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/think-library/src/extend/PhinxExtend.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/think-library/src/extend/PhinxExtend.php b/plugin/think-library/src/extend/PhinxExtend.php index 8f57fb335..0fd3ae3fa 100644 --- a/plugin/think-library/src/extend/PhinxExtend.php +++ b/plugin/think-library/src/extend/PhinxExtend.php @@ -20,6 +20,7 @@ namespace think\admin\extend; use Exception; use Phinx\Db\Adapter\AdapterInterface; +use Phinx\Db\Adapter\MysqlAdapter; use Phinx\Db\Table; use SplFileInfo; use think\admin\Library; @@ -292,7 +293,9 @@ CODE; if ($field['name'] === 'id') continue; $type = $types[$field['type']] ?? $field['type']; $data = ['default' => $field['default'], 'null' => empty($field['notnull']), 'comment' => $field['comment'] ?? '']; - if ($field['type'] === 'enum') { + if ($field['type'] === 'longtext') { + $data = array_merge(['limit' => MysqlAdapter::TEXT_LONG], $data); + } elseif ($field['type'] === 'enum') { $type = $types[$field['type']] ?? 'string'; $data = array_merge(['limit' => 10], $data); } elseif (preg_match('/(tinyblob|blob|mediumblob|longblob|varbinary|bit|binary|varchar|char)\((\d+)\)/', $field['type'], $attr)) {