Skip to content

Commit

Permalink
默认值是数字0 和字符串0
Browse files Browse the repository at this point in the history
当识别是字符串0时,导致其丢失问题
  • Loading branch information
e282486518 committed Jul 11, 2019
1 parent 0d447cb commit bf290b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/MigrateCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function getTableField($column){
$fields .= (empty($column->defaultValue)) ? '' : " DEFAULT " . $column->defaultValue['expression'] . " ";
} elseif (is_object($column->defaultValue)) {
$fields .= " DEFAULT {$column->defaultValue}";
} elseif (is_int($column->defaultValue) || !empty($column->defaultValue) || $column->defaultValue == '') {
} elseif (is_int($column->defaultValue) || !empty($column->defaultValue) || $column->defaultValue == '' || $column->defaultValue == '0') {
$fields .= " DEFAULT '{$column->defaultValue}'";
} elseif (is_null($column->defaultValue)) {
$fields .= " DEFAULT NULL";
Expand Down

0 comments on commit bf290b3

Please sign in to comment.