Created
September 11, 2011 22:14
-
-
Save sergeych/1210201 to your computer and use it in GitHub Desktop.
bash script: git pull && pass rails migrations if need
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 | |
# | |
# git pull && run migratoins if need | |
dbtime=`stat -f "%m" db/migrate` | |
schema=`stat -f "%m" db/schema.rb` | |
git pull || exit | |
# If either schema or migrate dir has been changed, run migrations and test db prepare | |
# in general, we need not to check schema despite the case that existing migration has | |
# been changed. It, most likely, will cause problems anyway | |
if [[ $dbtime != `stat -f "%m" db/migrate` || $schema != `stat -f "%m" db/schema.rb` ]]; then | |
echo "Starting migrations" | |
bundle exec rake db:migrate db:test:prepare | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment