From 66e2ea514174d7d4407c358294df018c240eaa02 Mon Sep 17 00:00:00 2001 From: JaguarJack <82664165@qq.com> Date: Fri, 6 Aug 2021 10:20:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E8=A1=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=20nullable=20=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/generate/factory/SQL.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extend/catcher/generate/factory/SQL.php b/extend/catcher/generate/factory/SQL.php index d7e0856..3778d07 100644 --- a/extend/catcher/generate/factory/SQL.php +++ b/extend/catcher/generate/factory/SQL.php @@ -77,13 +77,12 @@ class SQL extends Factory $tableColumn->setUnsigned(); } - if ($column['comment']) { $tableColumn->setComment($column['comment']); } - if (!$this->doNotNeedDefaultValueType($column['type'])) { - $tableColumn->setDefault($column['default']); + if (! $this->doNotNeedDefaultValueType($column['type'])) { + $tableColumn->setDefault($column['nullable'] ? null : $column['default']); } $tableColumns[] = $tableColumn;