Use this plugin to properly clone a PostgreSQL database from Heroku to localhost. The main difference between this plugin and db:pull is that foreign keys and other db constraints are handled properly.
After that, a simple
$ heroku plugins:install [email protected]:chebyte/heroku_clonedb.git
will get you up and running.
If you are using HeroCutter for install your plugins for heroku, you can do this:
$ heroku plugins:install git://github.com/hone/heroku_herocutter.git
and finally
$ heroku plugins:install clonedb
From your project’s root directory:
For load a data dump from heroku app to localhost:
$ heroku clonedb --from app_name
If you want before load data dump from heroku, drop and create the db again, you can use:
$ heroku clonedb --from app_name --drop
For transfer data from one app to another:
$ heroku clonedb --from app_name1 --to app_name2
For transfer data from url dump to heroku app:
$ heroku clonedb --from-url 'http://s3.amazonaws.com/.....mydb.dump?authparameters' --to app_name
For get a data dump from heroku app:
$ heroku clonedb --dump --from app_name [--dir <dir_path>]
And this is all :)
-
Mauro Torres.
-
Kyle J. Ginavan - github.com/kylejginavan
Please contact me if there is any enhancements you would like to this project.