简体   繁体   中英

Heroku remote database must be empty error after pg:reset

I have an app on Heroku and I'm trying to replace the database on Heroku with the database on my local machine.

I was under the impression that

heroku pg:reset DATABASE

would clear the remote database and allow me to push. However, after running pg:reset, I run

heroku pg:push

and I stil get this error:

Usage: heroku pg:push <LOCAL_SOURCE_DATABASE> <REMOTE_TARGET_DATABASE>

 push from LOCAL_SOURCE_DATABASE to REMOTE_TARGET_DATABASE
 REMOTE_TARGET_DATABASE must be empty.

Couple of questions: 1. do I have to specify local db and remote db? [I am in the root directory of my application on my local machine] 2. if so, how do I find what my local database name is? I know that heroku can divine the remote database via DATABASE_URL?

You have to specify BOTH the local database(where the data is coming from) and the remote database(where the data is going). The part about REMOTE_TARGET_DATABASE must be empty. is just a reminder to make sure you clear the Heroku database before you push.

You should be able to find your database from your database.yml file.

You can also find the heroku database by heroku pg:info

Reminder : Heroku runs PostgreSQL so you should be using PostgreSQL locally as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM