Skip to content

Instantly share code, notes, and snippets.

@dvdbng
Created December 6, 2016 21:56
Show Gist options
  • Save dvdbng/82b15106c601071349f18e1410a7deda to your computer and use it in GitHub Desktop.
Save dvdbng/82b15106c601071349f18e1410a7deda to your computer and use it in GitHub Desktop.
rails rake db:migrate pg_dump docker
#!/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
@darkn3rd
Copy link

Why does rails do this and ignore the remote host specified in config/database.yml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment