summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJasper Maes <jaspermaes.jm@gmail.com>2018-08-30 08:28:15 +0200
committerJasper Maes <jaspermaes.jm@gmail.com>2018-08-30 08:29:08 +0200
commit8f51727d95a70058e1b7db06a022b6cd6b12198e (patch)
tree1179eaecbd32120920483fd326bcc2eaea20fc66 /scripts
parentf981d4febbbb5103262f4daa858236d9c4ed9d67 (diff)
downloadgitlab-ce-8f51727d95a70058e1b7db06a022b6cd6b12198e.tar.gz
Backport schema_changed.sh from EE which prints the diff if the schema is different
Diffstat (limited to 'scripts')
-rw-r--r--scripts/schema_changed.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/schema_changed.sh b/scripts/schema_changed.sh
index 5de2b35571d..b5e510c2367 100644
--- a/scripts/schema_changed.sh
+++ b/scripts/schema_changed.sh
@@ -1,9 +1,14 @@
-function schema_changed() {
- if [[ ! -z `git diff --name-only -- db/schema.rb` ]]; then
- echo "db/schema.rb after rake db:migrate:reset is different from one in the repository"
+#!/bin/sh
+
+schema_changed() {
+ if [ ! -z "$(git diff --name-only -- db/schema.rb)" ]; then
+ printf "db/schema.rb after rake db:migrate:reset is different from one in the repository"
+ printf "The diff is as follows:\n"
+ diff=$(git diff -p --binary -- db/schema.rb)
+ printf "%s" "$diff"
exit 1
else
- echo "db/schema.rb after rake db:migrate:reset matches one in the repository"
+ printf "db/schema.rb after rake db:migrate:reset matches one in the repository"
fi
}