From 3cf3560a2061cd7d6456bfacf27fe5f08c4703d0 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 5 Aug 2013 18:35:20 -0700 Subject: [PATCH] SQLite: Show primary key when altering indexes --- adminer/drivers/sqlite.inc.php | 2 +- adminer/indexes.inc.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php index 6fd76726..e8e6e12b 100644 --- a/adminer/drivers/sqlite.inc.php +++ b/adminer/drivers/sqlite.inc.php @@ -318,7 +318,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) { } } if ($primary) { - $return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array()); + $return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array()); //! column order, descending } $sqls = get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q($table)); foreach (get_rows("PRAGMA index_list(" . table($table) . ")") as $row) { diff --git a/adminer/indexes.inc.php b/adminer/indexes.inc.php index 9eb8710a..b9006772 100644 --- a/adminer/indexes.inc.php +++ b/adminer/indexes.inc.php @@ -6,7 +6,9 @@ if (preg_match('~MyISAM|M?aria' . ($connection->server_info >= 5.6 ? '|InnoDB' : $index_types[] = "FULLTEXT"; } $indexes = indexes($TABLE); +$primary = array(); if ($jush == "sqlite") { // doesn't support primary key + $primary = $indexes[""]; unset($index_types[0]); unset($indexes[""]); } @@ -97,6 +99,14 @@ if (!$row) {   PRIMARY"; + foreach ($primary["columns"] as $key => $column) { + echo ""; + echo " "; + } + echo "\n"; +} $j = 1; foreach ($row["indexes"] as $index) { if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {