Last active
August 29, 2015 14:20
-
-
Save bitamar/a7c698ac2bc67892b108 to your computer and use it in GitHub Desktop.
WIP: Download and import a drupal database from pantheon cli (Terminus)
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
#!/usr/bin/env bash | |
EMAIL="[email protected]" | |
SITE="mypantheonsite" | |
ENVIRONMENT="live" | |
terminus auth login $EMAIL | |
terminus site backup create --site=$SITE --env=$ENVIRONMENT --element=database | |
DUMPURL=`terminus site backup get --site=$SITE --env=$ENVIRONMENT --element=database --latest` | |
echo "Fetching $SITE database" | |
curl -o $SITE.sql.gz $DUMPURL | |
gunzip $SITE.sql.gz | |
mysql -uroot -e "DROP SCHEMA $SITE; CREATE SCHEMA $SITE" | |
mysql -uroot $SITE < $SITE.sql | |
mysql -uroot -e "USE $SITE; UPDATE users SET mail = CONCAT(mail, '.test')" | |
terminus auth logout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment