【发布时间】:2017-10-09 05:55:54
【问题描述】:
我正在尝试将我的 Rails 应用程序的数据库从 SQLite3 迁移到 Postgresql ,但发现这一点并不容易。我正在关注这个 Railscast (http://railscasts.com/episodes/342-migrating-to-postgresql)。
我已将我的 database.yml 文件编辑为以下内容:
default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.postgresql
test:
<<: *default
database: db/test.postgresql
production:
<<: *default
database: db/production.postgresql
我在这里所做的只是将所有显示“SQLite3”的部分更改为“postgresql”。这与 Railscast 不同,但我猜它已经过时(2012 年)。
我已经安装了 gem 'pg', '~> 0.21.0',并删除了 SQLite3 gem。我已经安装了 Postgresql 9.6.3。
接下来我安装了 taps gem (0.3.24)。在此之后我尝试了 'rake db:create:all' 但返回的错误消息如下:
fe_sendauth: no password supplied
Couldn't create database for {"adapter"=>"postgresql", "pool"=>5,
"timeout"=>5000, "database"=>"db/development.postgresql"}
rake aborted!
我在这个网站上读到我可能需要进行 Heroku 迁移 - 'heroku run rake db:migrate',但是当我尝试这样做时,会返回相同的错误。
我真的不知道这个错误消息是什么意思 - 我认为这可能与 conf_hba 文件或 pgAdmin 有关,但我也不明白它们是如何工作的。
非常感谢您的帮助,谢谢:-)
【问题讨论】:
标签: ruby-on-rails postgresql heroku sqlite