From a10238516c038382e64d2ae476f2ec11faf46a28 Mon Sep 17 00:00:00 2001 From: Matthew Gamble Date: Sun, 6 Dec 2015 11:43:49 +1100 Subject: [PATCH] Add plugin for printing table indexes structure in expanded format --- plugins/table-indexes-structure.php | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plugins/table-indexes-structure.php diff --git a/plugins/table-indexes-structure.php b/plugins/table-indexes-structure.php new file mode 100644 index 00000000..354c602b --- /dev/null +++ b/plugins/table-indexes-structure.php @@ -0,0 +1,33 @@ +\n"; + echo "" . lang('Name') . "" . lang('Type') . "" . lang('Columns') . "\n"; + foreach ($indexes as $name => $index) { + echo "" . h($name) . "" . $index['type']; + ksort($index["columns"]); // enforce correct columns order + $print = array(); + foreach ($index["columns"] as $key => $val) { + $print[] = "" . h($val) . "" + . ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "") + . ($index["descs"][$key] ? " DESC" : "") + ; + } + echo "" . implode(", ", $print) . "\n"; + } + echo "\n"; + return true; + } +}