Skip to content

Instantly share code, notes, and snippets.

@bitamar
Last active August 29, 2015 14:20
Show Gist options
  • Save bitamar/a7c698ac2bc67892b108 to your computer and use it in GitHub Desktop.
Save bitamar/a7c698ac2bc67892b108 to your computer and use it in GitHub Desktop.
WIP: Download and import a drupal database from pantheon cli (Terminus)
#!/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