summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-08-30 15:27:25 +0000
committerRémy Coutable <remy@rymai.me>2018-08-30 15:27:25 +0000
commitff0a5936275a6f098d06c3d092090e10643f213a (patch)
tree3c088fabb23394ce5a84b8291b0719769b078480
parent40935fd736b5c92d7c168afab8380b16b8176abc (diff)
parent8f51727d95a70058e1b7db06a022b6cd6b12198e (diff)
downloadgitlab-ce-ff0a5936275a6f098d06c3d092090e10643f213a.tar.gz
Merge branch 'schema-changed-ee-backport' into 'master'
Backport schema_changed.sh from EE which prints the diff if the schema is different See merge request gitlab-org/gitlab-ce!21422
-rw-r--r--changelogs/unreleased/schema-changed-ee-backport.yml5
-rw-r--r--scripts/schema_changed.sh13
2 files changed, 14 insertions, 4 deletions
diff --git a/changelogs/unreleased/schema-changed-ee-backport.yml b/changelogs/unreleased/schema-changed-ee-backport.yml
new file mode 100644
index 00000000000..f3b16fc0c27
--- /dev/null
+++ b/changelogs/unreleased/schema-changed-ee-backport.yml
@@ -0,0 +1,5 @@
+---
+title: Backport schema_changed.sh from EE which prints the diff if the schema is different
+merge_request: 21422
+author: Jasper Maes
+type: other
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
}