【发布时间】:2017-01-13 00:33:03
【问题描述】:
我正在尝试从我的 Heroku 应用程序中获取最新的生产数据,并将其恢复到我在本地主机上的开发数据库中。我用
备份了我的生产数据库heroku pg:backups capture --app <my-app-name>
并使用下载它
curl -o latest.dump `heroku pg:backups public-url`
听起来我需要将它从 PostgreSQL 转换为 Sqlite3,可能使用类似http://manuelvanrijn.nl/blog/2012/01/18/convert-postgresql-to-sqlite/ 的过程,但我不是 100% 的。有没有更好的方法将二进制latest.dump 数据恢复到我的development.sqlite3 中?
编辑:听起来我需要做的就是在我的机器上设置 Postgres,重新配置我的 RoR 应用程序设置以使用 Postgres,并使用 pg_restore 恢复生产数据库。由于我的 database.yml 文件,我有点困惑:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
heroku 是否忽略了生产设置并仍然使用 Postgres?
【问题讨论】:
-
在理想情况下,您应该使用
Postgres,恕我直言,尝试使用Postgresql进行开发,并使用常规postgres命令转储数据。请不要花时间在这些事情上。您可以轻松跳过这部分并学习更重要的内容。
标签: ruby-on-rails postgresql heroku sqlite