Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/check-db-structure
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-16 16:46:41 +0200
committerErich Eckner <git@eckner.net>2018-04-16 16:46:41 +0200
commit7dd3fc81fd48e5b72c7f7b3c090dea9f65553fe2 (patch)
tree6addc055afaf6683b9eceb2ad52f7846472c40fd /bin/check-db-structure
parent14223e1268d5cbe47ed25446f50c343c8a8938d0 (diff)
bin/check-db-structure: new to dump the structure of the database
Diffstat (limited to 'bin/check-db-structure')
-rwxr-xr-xbin/check-db-structure19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/check-db-structure b/bin/check-db-structure
new file mode 100755
index 0000000..f0cdf89
--- /dev/null
+++ b/bin/check-db-structure
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# shellcheck source=../conf/default.conf
+. "${0%/*}/../conf/default.conf"
+
+# shellcheck disable=SC2016
+{
+ printf 'SELECT `proc`.`name` FROM `mysql`.`proc` WHERE `proc`.`Db`="buildmaster"' | \
+ mysql_run_query | \
+ while read -r procedure; do
+ printf 'SHOW CREATE PROCEDURE `%s`;\n' "${procedure}"
+ done
+ printf 'SHOW TABLES' | \
+ mysql_run_query | \
+ while read -r table; do
+ printf 'SHOW CREATE TABLE `%s`;\n' "${table}"
+ done
+} | \
+ mysql_run_query