Postgres将Heroku Production DB复制到本地开发DB [英] Postgres copy Heroku Production DB to local development DB

查看:199
本文介绍了Postgres将Heroku Production DB复制到本地开发DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个heroku数据库, d76mj7ltuqs

I have a heroku database, d76mj7ltuqs.

然后我有一个本地数据库, test_development

I then have a local database, test_development.

这两个数据库的模式是相同的 - 我想从生产数据库中提取所有数据,

The schema is the same on both of these databases - I want to pull all of the data from my production database and overwrite my local database, so that local is an exact replica of production at the time of pull.

如何在Postgres中执行此操作?

How can I do that in Postgres?

推荐答案

使用heroku的pg:pull:

Use heroku's "pg:pull":

您需要清除本地数据库:

You'll need to clear your local DB:

rake db:drop

从Heroku收集一些信息:

The collect some information from Heroku:

heroku pg:pull DATABASE_URL test_development

这将连接到heroku数据库,并将其复制到本地数据库。

This will connect to the heroku DB, and copy it to the local database.

有关更多信息,请参见 Heroku的有关pg:pull 的文档详情。

See Heroku's documentation on pg:pull for more details.

这篇关于Postgres将Heroku Production DB复制到本地开发DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆