Always set $auto_increment_index
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1085 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
9aba67ea9d
commit
9e1029335b
|
@ -18,13 +18,11 @@ if (strlen($TABLE)) {
|
||||||
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
|
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
|
||||||
$auto_increment_index = " PRIMARY KEY";
|
$auto_increment_index = " PRIMARY KEY";
|
||||||
// don't overwrite primary key by auto_increment
|
// don't overwrite primary key by auto_increment
|
||||||
if (strlen($TABLE) && strlen($_POST["fields"][$_POST["auto_increment_col"]]["orig"])) {
|
if (strlen($TABLE) && $_POST["auto_increment_col"]) {
|
||||||
foreach (indexes($TABLE) as $index) {
|
foreach (indexes($TABLE) as $index) {
|
||||||
foreach ($index["columns"] as $column) {
|
if (in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"], $index["columns"], true)) {
|
||||||
if ($column === $_POST["fields"][$_POST["auto_increment_col"]]["orig"]) {
|
|
||||||
$auto_increment_index = "";
|
$auto_increment_index = "";
|
||||||
break 2;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($index["type"] == "PRIMARY") {
|
if ($index["type"] == "PRIMARY") {
|
||||||
$auto_increment_index = " UNIQUE";
|
$auto_increment_index = " UNIQUE";
|
||||||
|
@ -51,6 +49,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$after = "AFTER " . idf_escape($field["field"]);
|
$after = "AFTER " . idf_escape($field["field"]);
|
||||||
|
//! drop and create foreign keys with renamed columns
|
||||||
} elseif (strlen($field["orig"])) {
|
} elseif (strlen($field["orig"])) {
|
||||||
$fields .= "\nDROP " . idf_escape($field["orig"]) . ",";
|
$fields .= "\nDROP " . idf_escape($field["orig"]) . ",";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue