Skip to content

Instantly share code, notes, and snippets.

@lozadaOmr
Last active August 29, 2015 14:00
Show Gist options
  • Save lozadaOmr/d651a686e06f0462d1bb to your computer and use it in GitHub Desktop.
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.
#!/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
@lozadaOmr
Copy link
Author

Original Source Code snippet by Rafael Dohms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment