Created
September 9, 2014 02:20
-
-
Save alex-zige/6f77d3a4e1403339c587 to your computer and use it in GitHub Desktop.
DB reset (drop & create & migrate & seed)
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
# check if stdout is a terminal... | |
if [ -t 1 ]; then | |
# see if it supports colors... | |
ncolors=$(tput colors) | |
if test -n "$ncolors" && test $ncolors -ge 8; then | |
bold="$(tput bold)" | |
underline="$(tput smul)" | |
standout="$(tput smso)" | |
normal="$(tput sgr0)" | |
black="$(tput setaf 0)" | |
red="$(tput setaf 1)" | |
green="$(tput setaf 2)" | |
yellow="$(tput setaf 3)" | |
blue="$(tput setaf 4)" | |
magenta="$(tput setaf 5)" | |
cyan="$(tput setaf 6)" | |
white="$(tput setaf 7)" | |
fi | |
fi | |
echo "==> Dropping off existed database..." | |
rake db:drop | |
echo "${green}[OK]${normal}" | |
echo "==> Create new database..." | |
bundle exec rake db:create | |
echo "${green}[OK]${normal}" | |
echo "==> Reset database schema" | |
bundle exec rake db:migrate | |
echo "${green}[OK]${normal}" | |
echo "==> Seed database" | |
bundle exec rake db:seed | |
echo "${green}[OK]${normal}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment