Commit 135dd512 authored by Rémy Coutable's avatar Rémy Coutable

Print the diff in scripts/schema_changed.sh

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 8e007e88
......@@ -507,7 +507,7 @@ db:check-schema-pg:
<<: *db-migrate-reset
<<: *use-pg
script:
- source scripts/schema_changed.sh
- sh scripts/schema_changed.sh
# Frontend-related jobs
gitlab:assets:compile:
......
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
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment