debian-mirror-gitlab/scripts/schema_changed.sh

16 lines
401 B
Bash
Raw Normal View History

2018-11-20 20:47:30 +05:30
#!/bin/sh
schema_changed() {
2020-04-22 19:07:51 +05:30
if [ ! -z "$(git diff --name-only -- db/structure.sql)" ]; then
2020-05-24 23:13:21 +05:30
printf "Schema changes are not cleanly committed to db/structure.sql\n"
2018-11-20 20:47:30 +05:30
printf "The diff is as follows:\n"
2020-04-22 19:07:51 +05:30
diff=$(git diff -p --binary -- db/structure.sql)
2018-11-20 20:47:30 +05:30
printf "%s" "$diff"
2018-03-17 18:26:18 +05:30
exit 1
else
2020-05-24 23:13:21 +05:30
printf "Schema changes are correctly applied to db/structure.sql\n"
2018-03-17 18:26:18 +05:30
fi
}
schema_changed