Update TableController.php
This commit is contained in:
parent
c72cfdec8f
commit
17bf447521
@ -1458,7 +1458,7 @@ EOF;
|
|||||||
$field = Util::filterAlphaNum($column['field']);
|
$field = Util::filterAlphaNum($column['field']);
|
||||||
$old_field = Util::filterAlphaNum($column['old_field'] ?? null);
|
$old_field = Util::filterAlphaNum($column['old_field'] ?? null);
|
||||||
$nullable = $column['nullable'];
|
$nullable = $column['nullable'];
|
||||||
$default = Util::filterAlphaNum($column['default']);
|
$default = $column['default'] !== null ? Util::pdoQuote($column['default']) : null;
|
||||||
$comment = Util::pdoQuote($column['comment']);
|
$comment = Util::pdoQuote($column['comment']);
|
||||||
$auto_increment = $column['auto_increment'];
|
$auto_increment = $column['auto_increment'];
|
||||||
$length = (int)$column['length'];
|
$length = (int)$column['length'];
|
||||||
@ -1468,9 +1468,9 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($old_field && $old_field !== $field) {
|
if ($old_field && $old_field !== $field) {
|
||||||
$sql = "ALTER TABLE $table CHANGE COLUMN `$old_field` `$field` ";
|
$sql = "ALTER TABLE `$table` CHANGE COLUMN `$old_field` `$field` ";
|
||||||
} else {
|
} else {
|
||||||
$sql = "ALTER TABLE $table MODIFY `$field` ";
|
$sql = "ALTER TABLE `$table` MODIFY `$field` ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stripos($method, 'integer') !== false) {
|
if (stripos($method, 'integer') !== false) {
|
||||||
@ -1526,13 +1526,14 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($method != 'text' && $default !== null) {
|
if ($method != 'text' && $default !== null) {
|
||||||
$sql .= "DEFAULT '$default' ";
|
$sql .= "DEFAULT $default ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($comment !== null) {
|
if ($comment !== null) {
|
||||||
$sql .= "COMMENT $comment ";
|
$sql .= "COMMENT $comment ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "$sql\n";
|
||||||
Util::db()->statement($sql);
|
Util::db()->statement($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user