加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Heroku – 如何将数据从数据库提取到本地数据

发布时间:2020-12-17 01:32:52 所属栏目:百科 来源:网络整理
导读:我正在尝试从Heroku上获取数据库,并从那里获取数据以保存到我的本地数据库中. 当我尝试 heroku db:pull 并确认应用程序的名称,我得到: ! db:push and db:pull have been removed and replaced with pg:push and pg:pull. ! For more information,please see
我正在尝试从Heroku上获取数据库,并从那里获取数据以保存到我的本地数据库中.

当我尝试

heroku db:pull

并确认应用程序的名称,我得到:

!    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

好的,所以:

pg:pull

收益:

-bash: pg:pull: command not found

heroku pg:pull

回报

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

那么,如何正确提取数据呢?

解决方法

根据 Heroku Postgres help,您必须指定要从中拉出的数据库,以便pg:pull to work.

$heroku pg:pull HEROKU_POSTGRESQL_MAGENTA mylocaldb --app sushi

此命令将创建一个名为mylocaldb的新本地数据库,然后从应用程序寿司中的DATABASE_URL数据库中提取数据.为防止意外数据覆盖和丢失,本地数据库不得存在.在继续之前,系统将提示您删除已存在的本地数据库.

这也假设您在本地计算机上有Postgres.

heroku pg:info将在Heroku数据库中为您提供所有可用信息,例如名称.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读