diff options
author | Erich Eckner <git@eckner.net> | 2018-04-16 16:46:41 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-16 16:46:41 +0200 |
commit | 7dd3fc81fd48e5b72c7f7b3c090dea9f65553fe2 (patch) | |
tree | 6addc055afaf6683b9eceb2ad52f7846472c40fd /bin/check-db-structure | |
parent | 14223e1268d5cbe47ed25446f50c343c8a8938d0 (diff) | |
download | builder-7dd3fc81fd48e5b72c7f7b3c090dea9f65553fe2.tar.xz |
bin/check-db-structure: new to dump the structure of the database
Diffstat (limited to 'bin/check-db-structure')
-rwxr-xr-x | bin/check-db-structure | 19 |
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 |