Last active
January 18, 2019 19:20
-
-
Save aliselcuk/828b68ac20f44701d9c2c90b21ac0328 to your computer and use it in GitHub Desktop.
Bash script to reinstall SuperV cleanly
This file contains hidden or 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 | |
| # Get database name from .env file | |
| # | |
| DB_DATABASE=$(grep DB_DATABASE .env | cut -d '=' -f 2-) | |
| if [ -z $DB_DATABASE ]; then | |
| echo 'Could not read database name from .env file' | |
| exit | |
| fi | |
| # Drop all tables | |
| # | |
| echo $DB_DATABASE | xargs -I {} sh -c "mysql -Nse 'show tables' {}| xargs -I[] mysql -e 'SET FOREIGN_KEY_CHECKS=0; drop table []' {}" || exit 255 | |
| # Set SV_INSTALLED back to false | |
| # (Sed works slightly different in macOS) | |
| # | |
| if [[ "$OSTYPE" == "darwin"* ]]; then | |
| sed -i '' 's/^SV_INSTALLED=true/SV_INSTALLED=false/g' .env | |
| else | |
| sed -i 's/^SV_INSTALLED=true/SV_INSTALLED=false/g' .env | |
| fi | |
| php artisan migrate --force | |
| php artisan cache:clear | |
| php artisan superv:install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment