Navigation Menu

Skip to content

Commit

Permalink
Always set $auto_increment_index
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1085 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Sep 10, 2009
1 parent 9aba67e commit 9e10293
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions adminer/create.inc.php
Expand Up @@ -18,13 +18,11 @@
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
$auto_increment_index = " PRIMARY KEY";
// 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 ($index["columns"] as $column) {
if ($column === $_POST["fields"][$_POST["auto_increment_col"]]["orig"]) {
$auto_increment_index = "";
break 2;
}
if (in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"], $index["columns"], true)) {
$auto_increment_index = "";
break;
}
if ($index["type"] == "PRIMARY") {
$auto_increment_index = " UNIQUE";
Expand All @@ -51,6 +49,7 @@
}
}
$after = "AFTER " . idf_escape($field["field"]);
//! drop and create foreign keys with renamed columns
} elseif (strlen($field["orig"])) {
$fields .= "\nDROP " . idf_escape($field["orig"]) . ",";
}
Expand Down

0 comments on commit 9e10293

Please sign in to comment.