summaryrefslogtreecommitdiff
path: root/bin/check-db-structure
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-09 09:48:21 +0200
committerErich Eckner <git@eckner.net>2018-05-09 09:48:21 +0200
commitd9b9a2f81e539357feab0d2cc2e3042c5844294c (patch)
treef807d2c3731e01ed5fbb9b053ae94b2a7bc2fe08 /bin/check-db-structure
parentc35534f22082b9d5bf23797bd3fbb36f8b738254 (diff)
downloadbuilder-d9b9a2f81e539357feab0d2cc2e3042c5844294c.tar.xz
bin/check-db-structure: add dump of content of "constant" tables
Diffstat (limited to 'bin/check-db-structure')
-rwxr-xr-xbin/check-db-structure23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/check-db-structure b/bin/check-db-structure
index 3b85756..5f7d9c2 100755
--- a/bin/check-db-structure
+++ b/bin/check-db-structure
@@ -5,6 +5,8 @@
# shellcheck source=../conf/default.conf
. "${0%/*}/../conf/default.conf"
+# stored functions
+
# shellcheck disable=SC2016
{
printf 'SELECT `proc`.`name` FROM `mysql`.`proc` WHERE `proc`.`Db`="buildmaster"' | \
@@ -18,6 +20,9 @@
s/ \(SELECT\|FROM\|\(LEFT \|RIGHT \)\?JOIN\|ON\|WHERE\) /\n\t\1 /g
s/(SELECT/(\nSELECT/g
'
+
+# table headers
+
# shellcheck disable=SC2016
{
printf 'SHOW TABLES' | \
@@ -31,3 +36,21 @@
s/ AUTO_INCREMENT=[0-9]\+ / /g
s/^ /\t/
'
+
+# content of "constant" tables
+mysqldump --skip-lock-tables 'buildmaster' \
+ 'architectures' \
+ 'dependency_types' \
+ 'email_actions' \
+ 'fail_reasons' \
+ 'git_repositories' \
+ 'repositories' \
+ 'repository_moves' \
+ 'repository_stabilities' \
+ 'repository_stability_relations' \
+ 'upstream_repositories' | \
+ grep '^INSERT ' | \
+ sed '
+ s/),(/),\n (/g
+ s/VALUES (/VALUES\n (/g
+ '