Skip to content

Instantly share code, notes, and snippets.

@chebyte
Created November 25, 2011 19:09
Show Gist options
  • Select an option

  • Save chebyte/1394231 to your computer and use it in GitHub Desktop.

Select an option

Save chebyte/1394231 to your computer and use it in GitHub Desktop.
clone db from your heroku app
= Heroku CloneDB Plugin
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.
== Installation
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
== Usage
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 :)
== Authors:
* Mauro Torres.
* Kyle J. Ginavan - http://github.com/kylejginavan
== TODO:
Please contact me if there is any enhancements you would like
to this project.
@Sumedh9696
Copy link

.,..,.

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