Last active
February 3, 2016 10:52
-
-
Save wojtekmach/d57942eb13b055e89098 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This scripts re-runs all migrations in test DB | |
# and reports (along with exist status 1) any | |
# not commited changes to schema.rb. | |
# | |
# It's best to run this script on CI and fail the build | |
# because it means there's a discrepancy between migrations | |
# and schema.rb. (e.g. someone changed migration inline | |
# but forgot to redo the migration and update schema.rb.) | |
RAILS_ENV=test rake db:migrate:reset | |
if ! git diff --quiet db/schema.rb; then | |
echo "Found not committed changes to schema.rb! See below:" | |
git diff db/schema.rb | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment