use*_*621 3 ruby postgresql ruby-on-rails heroku
我试图在Heroku上获取数据库,并从那里获取数据以保存到我的本地数据库中.
当我尝试
heroku db:pull
Run Code Online (Sandbox Code Playgroud)
并确认应用程序的名称,我得到:
! 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
Run Code Online (Sandbox Code Playgroud)
好的,所以:
pg:pull
Run Code Online (Sandbox Code Playgroud)
收益:
-bash: pg:pull: command not found
heroku pg:pull
Run Code Online (Sandbox Code Playgroud)
回报
! `pg:pull` is not a heroku command.
! Perhaps you meant `db:pull` or `pg:psql`.
! See `heroku help` for a list of available commands.
Run Code Online (Sandbox Code Playgroud)
那么,如何正确提取数据呢?
根据Heroku Postgres的帮助,您必须指定要从pg:pull中工作的数据库.
$ heroku pg:pull HEROKU_POSTGRESQL_MAGENTA mylocaldb --app sushi
Run Code Online (Sandbox Code Playgroud)
此命令将创建一个名为的新本地数据库mylocaldb,然后DATABASE_URL从应用程序中从数据库中提取数据sushi.为防止意外数据覆盖和丢失,本地数据库不得存在.在继续之前,系统将提示您删除已存在的本地数据库.
这也假设您在本地计算机上有Postgres.
heroku pg:info 将在Heroku数据库中为您提供所有可用信息,例如名称.
| 归档时间: |
|
| 查看次数: |
4927 次 |
| 最近记录: |