Backport schema_changed.sh from EE which prints the diff if the schema is different
This commit is contained in:
parent
f981d4febb
commit
8f51727d95
2 changed files with 14 additions and 4 deletions
5
changelogs/unreleased/schema-changed-ee-backport.yml
Normal file
5
changelogs/unreleased/schema-changed-ee-backport.yml
Normal file
|
@ -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
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue