summaryrefslogtreecommitdiff
path: root/scripts/schema_changed.sh
blob: e8c120e92e1a03411632683159677a684de46db4 (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/structure.sql)" ]; then
    printf "db/structure.sql 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/structure.sql)
    printf "%s" "$diff"
    exit 1
  else
    printf "db/structure.sql after rake db:migrate:reset matches one in the repository"
  fi
}

schema_changed