Last active
August 29, 2015 14:10
-
-
Save dillonhafer/1bbd3a89442eede397f4 to your computer and use it in GitHub Desktop.
Push local database to heroku
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
function dumper { | |
if (( $# != 1 )); then | |
echo "Usage: dumper [DATABASE]" | |
echo "Creates pg_dump: pg_dump -Fc --no-acl --no-owner DATABASE > DATABASE.dump" | |
else | |
pg_dump -Fc --no-acl --no-owner $1 > $1.dump | |
fi | |
} | |
function push_dev_db { | |
if (( $# != 1 )); then | |
echo "Usage: push_dev_db [DATABASE]" | |
echo "Copies local db to heroku" | |
else | |
dumper $1 && | |
scp $1.dump server:files && | |
rm $1.dump && | |
heroku pgbackups:restore DATABASE "http://server/files/$1.dump" | |
ssh server "rm files/$1.dump" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment