Created
November 21, 2012 10:17
-
-
Save czj/4124118 to your computer and use it in GitHub Desktop.
Transfert Heroku production db to local dev db
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 | |
# Get to the Rails app's root directory | |
cd `dirname $0`/.. | |
APP_DIRECTORY=`pwd` | |
APP_NAME=`basename $APP_DIRECTORY` | |
# How-to: | |
# http://www.ryandaigle.com/a/pgtransfer-is-the-new-taps | |
if heroku plugins | grep -q "heroku-pg-transfer" | |
then | |
echo "Heroku PG transfer plugin already installed." | |
else | |
echo "Installing Heroku PG transfer plugin." | |
heroku plugins:install https://github.com/ddollar/heroku-pg-transfer | |
fi | |
# Transfert remote production database to local development database | |
heroku pg:transfer --to "postgres://localhost/${APP_NAME}_development" --confirm "$APP_NAME" | |
# App's link to postgres is corrupteda after database has been re-created | |
# Restart it via pow's / passenger's shortcut | |
touch tmp/restart.txt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment