3

I am trying to fetch database on Heroku and the data from there to save into my local database.

When I try

heroku db:pull

and confirm the name of the app, I get:

 !    db:push and db:pull have been removed and replaced with pg:push and pg:pull.
 !    For more information, please see:
 !      devcenter.heroku.com/articles/heroku-postgresql#pg-push-and-pg-pull

Ok, so:

pg:pull

returns:

-bash: pg:pull: command not found

heroku pg:pull

returns

 !    `pg:pull` is not a heroku command.
 !    Perhaps you meant `db:pull` or `pg:psql`.
 !    See `heroku help` for a list of available commands.

Thus, how to properly pull the data?

1
  • Have you find a solution to that?
    – arniotaki
    Sep 23, 2015 at 6:23

2 Answers 2

7

Per the Heroku Postgres help, you have to specify the database you are pulling from and to for pg:pull to work.

$ heroku pg:pull HEROKU_POSTGRESQL_MAGENTA mylocaldb --app sushi

This command will create a new local database named mylocaldb and then pull data from the database at DATABASE_URL from the app sushi. To prevent accidental data overwrites and loss, the local database must not exist. You will be prompted to drop an already existing local database before proceeding.

This also assumes you have Postgres on your local machine.

heroku pg:info will give you all available information, such as name, on your Heroku databases.

1
  • mylocaldb can be a Postgres URL like postgres://postgres:p0stgres@localhost/heroku, which will create a database called heroku
    – sudo
    Aug 3, 2019 at 17:46
0

in your project's dir, after installing taps gem, you can try using

taps server `heroku config:get DATABASE_URL` db db

to start a taps server, and then

taps push mysql://[usernme]:[password]@[host]/[database] http://db:db@localhost:500

to sync local db to heroku through taps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.