summaryrefslogtreecommitdiff
path: root/scripts/schema_changed.sh
blob: b5e510c236754dad1ca1526130db4e7a93c60367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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
    printf "db/schema.rb after rake db:migrate:reset matches one in the repository"
  fi
}

schema_changed