SQLite: Show primary key when altering indexes

This commit is contained in:
Jakub Vrana 2013-08-05 18:35:20 -07:00
parent 21dc4d939c
commit 3cf3560a20
2 changed files with 11 additions and 1 deletions

View file

@ -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) {

View file

@ -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) {
<th><noscript><input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='<?php echo lang('Add next'); ?>'></noscript>&nbsp;
</thead>
<?php
if ($primary) {
echo "<tr><td>PRIMARY<td>";
foreach ($primary["columns"] as $key => $column) {
echo "<select disabled>" . optionlist($fields, $column) . "</select>";
echo "<label><input disabled type='checkbox'>" . lang('descending') . "</label> ";
}
echo "<td><td>\n";
}
$j = 1;
foreach ($row["indexes"] as $index) {
if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {