summaryrefslogtreecommitdiff
path: root/lib/input/sql
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-08-08 09:08:25 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-08-08 09:08:25 +0100
commit3e3992bbab56da69fc0c39e10a11862dea7a5c43 (patch)
tree8730aefce6c72f51a31380a99335daa793d335af /lib/input/sql
parentPush lots of test logic into a fixture for easier test case creation (diff)
downloadmygrate-3e3992bbab56da69fc0c39e10a11862dea7a5c43.tar.bz2
mygrate-3e3992bbab56da69fc0c39e10a11862dea7a5c43.tar.xz
mygrate-3e3992bbab56da69fc0c39e10a11862dea7a5c43.zip
Create indexes and keys after copying table data
Diffstat (limited to 'lib/input/sql')
-rw-r--r--lib/input/sql/selectIndexes.sql7
1 files changed, 7 insertions, 0 deletions
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