mirror of
https://github.com/vrana/adminer.git
synced 2025-08-10 08:34:20 +02:00
Disable default value when changing from timestamp (bug #2935496)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1361 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -40,14 +40,14 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
|
|||||||
$type_field = (isset($types[$field["type"]]) ? $field : $referencable_primary[$foreign_keys[$field["type"]]]);
|
$type_field = (isset($types[$field["type"]]) ? $field : $referencable_primary[$foreign_keys[$field["type"]]]);
|
||||||
if ($field["field"] != "") {
|
if ($field["field"] != "") {
|
||||||
if ($type_field) {
|
if ($type_field) {
|
||||||
|
if (!$field["has_default"]) {
|
||||||
|
$field["default"] = null;
|
||||||
|
}
|
||||||
$default = eregi_replace(" *on update CURRENT_TIMESTAMP", "", $field["default"]);
|
$default = eregi_replace(" *on update CURRENT_TIMESTAMP", "", $field["default"]);
|
||||||
if ($default != $field["default"]) { // preg_replace $count is available since PHP 5.1.0
|
if ($default != $field["default"]) { // preg_replace $count is available since PHP 5.1.0
|
||||||
$field["on_update"] = "CURRENT_TIMESTAMP";
|
$field["on_update"] = "CURRENT_TIMESTAMP";
|
||||||
$field["default"] = $default;
|
$field["default"] = $default;
|
||||||
}
|
}
|
||||||
if (!$field["has_default"]) {
|
|
||||||
$field["default"] = null;
|
|
||||||
}
|
|
||||||
$process_field = process_field($field, $type_field);
|
$process_field = process_field($field, $type_field);
|
||||||
$auto_increment = ($key == $_POST["auto_increment_col"]);
|
$auto_increment = ($key == $_POST["auto_increment_col"]);
|
||||||
if ($process_field != process_field($orig_field, $orig_field) || $orig_field["auto_increment"] != $auto_increment) {
|
if ($process_field != process_field($orig_field, $orig_field) || $orig_field["auto_increment"] != $auto_increment) {
|
||||||
|
@@ -200,6 +200,9 @@ function editingTypeChange(type) {
|
|||||||
)) {
|
)) {
|
||||||
el.value = '';
|
el.value = '';
|
||||||
}
|
}
|
||||||
|
if (lastType == 'timestamp' && el.name == name + '[has_default]' && /timestamp/i.test(formField(type.form, name + '[default]').value)) {
|
||||||
|
el.checked = false;
|
||||||
|
}
|
||||||
if (el.name == name + '[collation]') {
|
if (el.name == name + '[collation]') {
|
||||||
el.className = (/(char|text|enum|set)$/.test(text) ? '' : 'hidden');
|
el.className = (/(char|text|enum|set)$/.test(text) ? '' : 'hidden');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user