Created
December 6, 2016 21:56
-
-
Save dvdbng/82b15106c601071349f18e1410a7deda to your computer and use it in GitHub Desktop.
rails rake db:migrate pg_dump docker
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 | |
# rake db:migrate tries to connect to dump local postgres using pg_dump but | |
# you are using a docker instance? try saving this script as pg_dump somewhere | |
# in your PATH with higher priority | |
orig_params="$@" | |
volmount="" | |
while [[ $# -gt 1 ]] | |
do | |
if [ "-f" = "$1" ] | |
then | |
volmount="-v $2:$2" | |
shift | |
fi | |
shift | |
done | |
docker run -it --rm $volmount --net=host postgres:9.4 pg_dump -h localhost -U postgres $orig_params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why does rails do this and ignore the remote host specified in config/database.yml?