Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Transfer Heroku Postgres databases

branch: master

Merge pull request #8 from ankane/master

Added --tables option
latest commit 5129c45bef
David Dollar authored July 10, 2013
Octocat-spinner-32 README.md tweak readme June 20, 2012
Octocat-spinner-32 init.rb Added --tables option July 09, 2013
README.md

heroku-pg-transfer

Installation

$ heroku plugins:install https://github.com/ddollar/heroku-pg-transfer

Usage

$ heroku help pg:transfer
Usage: heroku pg:transfer

 transfer data between databases

 -f, --from DATABASE  # source database, defaults to DATABASE_URL on the app
 -t, --to   DATABASE  # target database, defaults to local $DATABASE_URL
$ env DATABASE_URL=postgres://localhost/myapp-development heroku pg:transfer
Source database: DATABASE on myapp.herokuapp.com
Target database: myapp-development on localhost:5432
pg_dump: reading schemas
pg_dump: reading user-defined tables
...
$ heroku pg:transfer --from charcoal --to postgres://foo
Source database: HEROKU_POSTGRESQL_CHARCOAL on myapp.herokuapp.com
Target database: foo on localhost:5432
pg_dump: reading schemas
pg_dump: reading user-defined tables
...
$ source .env && heroku pg:transfer --from $DATABASE_URL --to charcoal
Source database: myapp-development on localhost:5432
Target database: HEROKU_POSTGRESQL_CHARCOAL on myapp.herokuapp.com
pg_dump: reading schemas
pg_dump: reading user-defined tables
...
# detects non-postgres url
$ heroku pg:transfer --to mysql://foo
!    Only PostgreSQL databases can be transferred with this command.
!    For information on transferring other database types, see:
!    https://devcenter.heroku.com/articles/import-data-heroku-postgres
# if they dont have a local $DATABASE_URL
$ heroku pg:transfer
!    No local DATABASE_URL detected and --to not specified.
!    For information on using config vars locally, see:
!    https://devcenter.heroku.com/articles/config-vars#local_setup
Something went wrong with that request. Please try again.