From 3e3992bbab56da69fc0c39e10a11862dea7a5c43 Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Sun, 8 Aug 2021 09:08:25 +0100
Subject: Create indexes and keys after copying table data

---
 lib/input/sql/selectIndexes.sql | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/input/sql/selectIndexes.sql

(limited to 'lib/input/sql/selectIndexes.sql')

diff --git a/lib/input/sql/selectIndexes.sql b/lib/input/sql/selectIndexes.sql
new file mode 100644
index 0000000..f1f3375
--- /dev/null
+++ b/lib/input/sql/selectIndexes.sql
@@ -0,0 +1,7 @@
+SELECT table_name, index_name, 
+	GROUP_CONCAT(column_name ORDER BY seq_in_index) columns, 
+	MIN(non_unique) non_unique 
+FROM information_schema.statistics s 
+WHERE table_schema = DATABASE()
+AND table_name = ?
+GROUP BY table_name, index_name
-- 
cgit v1.2.3

