summaryrefslogtreecommitdiff
path: root/bin/check-db-structure
blob: c92182ce0ad9891a480292eb3d2f561c4181f026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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 | \
  sed '
    s/ AUTO_INCREMENT=[0-9]\+ / /g
  '