Last active
August 29, 2015 14:00
-
-
Save lozadaOmr/d651a686e06f0462d1bb to your computer and use it in GitHub Desktop.
A simple post-checkout hook, which drops the database, creates it and run migrations and seeding.
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 | |
user=root | |
password=root | |
exec < /dev/tty | |
clear | |
while true; do | |
read -p "Run Migrations[Y/n]: " yn | |
case $yn in | |
[Yy]* ) | |
echo "$(tput bold setab[1])Dropping database $(tput sgr 0) " | |
mysql --user="$user" --password="$password" -e 'drop database `mw`'; | |
echo "$(tput bold setab[2])Creating database $(tput sgr 0) " | |
mysql --user="$user" --password="$password" -e 'create database `mw`'; | |
php artisan migrate:install; | |
php artisan migrate; | |
php artisan db:seed; break;; | |
[Nn]* ) exit; break;; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original Source Code snippet by Rafael Dohms