Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Always set $auto_increment_index

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1085 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit 9e1029335b6432970b49da54165385509a2689fd 1 parent 9aba67e
jakubvrana authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 adminer/create.inc.php
11 adminer/create.inc.php
View
@@ -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";
@@ -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"]) . ",";
}
Please sign in to comment.
Something went wrong with that request. Please try again.