From 9a0dbd7031c726401f9c11e6940f6e908925454e Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Thu, 6 May 2021 13:23:20 +0800 Subject: [PATCH] upgrade do not change table field default value --- nexus/Install/update/update.php | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/nexus/Install/update/update.php b/nexus/Install/update/update.php index 130ced93..1f888d34 100644 --- a/nexus/Install/update/update.php +++ b/nexus/Install/update/update.php @@ -105,32 +105,32 @@ if ($currentStep == 3) { continue; } //Field invalid - if ($fieldInfo['Null'] == 'NO' && $fieldInfo['Default'] === null && $fieldInfo['Key'] != 'PRI') { - $typePrefix = $fieldInfo['Type']; - if (($pos = strpos($typePrefix, '(')) !== false) { - $typePrefix = substr($typePrefix, 0, $pos); - } - if (preg_match('/varchar/', $typePrefix)) { - $tableRows[] = [ - 'label' => "Field: $table.$field", - 'required' => "default ''", - 'current' => 'null', - 'result' => 'NO', - ]; - $toAlterTable[$table][$field] = "modify $field {$fieldInfo['Type']} not null default ''"; - continue; - } - if (preg_match('/int/', $typePrefix)) { - $tableRows[] = [ - 'label' => "Field: $table.$field", - 'required' => "default 0", - 'current' => 'null', - 'result' => 'NO', - ]; - $toAlterTable[$table][$field] = "modify $field {$fieldInfo['Type']} not null default 0"; - continue; - } - } +// if ($fieldInfo['Null'] == 'NO' && $fieldInfo['Default'] === null && $fieldInfo['Key'] != 'PRI') { +// $typePrefix = $fieldInfo['Type']; +// if (($pos = strpos($typePrefix, '(')) !== false) { +// $typePrefix = substr($typePrefix, 0, $pos); +// } +// if (preg_match('/varchar/', $typePrefix)) { +// $tableRows[] = [ +// 'label' => "Field: $table.$field", +// 'required' => "default ''", +// 'current' => 'null', +// 'result' => 'NO', +// ]; +// $toAlterTable[$table][$field] = "modify $field {$fieldInfo['Type']} not null default ''"; +// continue; +// } +// if (preg_match('/int/', $typePrefix)) { +// $tableRows[] = [ +// 'label' => "Field: $table.$field", +// 'required' => "default 0", +// 'current' => 'null', +// 'result' => 'NO', +// ]; +// $toAlterTable[$table][$field] = "modify $field {$fieldInfo['Type']} not null default 0"; +// continue; +// } +// } } } while ($isPost) {