mirror of
https://github.com/vrana/adminer.git
synced 2025-08-10 16:44:17 +02:00
Selectable ON UPDATE CURRENT_TIMESTAMP field in create table
This commit is contained in:
@@ -152,6 +152,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
|
||||
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"><td class="options"><?php //! type="number" with enabled JavaScript
|
||||
echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
||||
echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
||||
echo (isset($field['on_update']) ? "<select name='$key" . "[on_update]'" . ($field["type"] == "timestamp" ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
|
||||
echo ($foreign_keys ? "<select name='$key" . "[on_delete]'" . (ereg("`", $field["type"]) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
||||
}
|
||||
|
||||
@@ -189,7 +190,7 @@ function process_field($field, $type_field) {
|
||||
process_type($type_field),
|
||||
($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
|
||||
(isset($field["default"]) ? " DEFAULT " . ((ereg("time", $field["type"]) && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""),
|
||||
($field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
|
||||
($field["type"] == "timestamp" && $field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
|
||||
(support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""),
|
||||
($field["auto_increment"] ? auto_increment() : null),
|
||||
);
|
||||
|
Reference in New Issue
Block a user