Fix Undefined index: Collation in DBStructure

This commit is contained in:
Hypolite Petovan 2018-07-02 22:28:27 -04:00
parent 58e1470ddb
commit e7d6b48bb3
1 changed files with 5 additions and 5 deletions

View File

@ -537,26 +537,26 @@ class DBStructure
private static function FieldCommand($parameters, $create = true) { private static function FieldCommand($parameters, $create = true) {
$fieldstruct = $parameters["type"]; $fieldstruct = $parameters["type"];
if (!is_null($parameters["Collation"])) { if (!empty($parameters["Collation"])) {
$fieldstruct .= " COLLATE ".$parameters["Collation"]; $fieldstruct .= " COLLATE ".$parameters["Collation"];
} }
if ($parameters["not null"]) { if (!empty($parameters["not null"])) {
$fieldstruct .= " NOT NULL"; $fieldstruct .= " NOT NULL";
} }
if (isset($parameters["default"])) { if (!empty($parameters["default"])) {
if (strpos(strtolower($parameters["type"]),"int")!==false) { if (strpos(strtolower($parameters["type"]),"int")!==false) {
$fieldstruct .= " DEFAULT ".$parameters["default"]; $fieldstruct .= " DEFAULT ".$parameters["default"];
} else { } else {
$fieldstruct .= " DEFAULT '".$parameters["default"]."'"; $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
} }
} }
if ($parameters["extra"] != "") { if (!empty($parameters["extra"])) {
$fieldstruct .= " ".$parameters["extra"]; $fieldstruct .= " ".$parameters["extra"];
} }
if (!is_null($parameters["comment"])) { if (!empty($parameters["comment"])) {
$fieldstruct .= " COMMENT '".dbesc($parameters["comment"])."'"; $fieldstruct .= " COMMENT '".dbesc($parameters["comment"])."'";
} }