summaryrefslogtreecommitdiff
path: root/bin/check-db-structure
blob: f0cdf8954a18f6d94047ddcfc3e404d8ff4740bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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