Sqlite3得到ActiveRecord :: ConnectionTimeoutError Heroku

时间:2014-05-29 18:04:36

标签: ruby-on-rails sqlite heroku ruby-on-rails-4

我正在使用Rails 4.0.4。这个错误发生了更多,但我从4.0.1升级。

我们在生产中使用sqlite3(我甚至没有意识到)。我以前创建了一个postgres数据库,我想我们可以切换到postgres,如果这似乎可能是问题。会是什么呢? [如果是bc sqlite,有没有简单的方法将过去的数据转换成sqlite数据?]

2014-05-29T17:46:29.300034+00:00 app[web.2]: ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds (waited 5.003 seconds)):

http://pastebin.com/8pZKvpUk

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

我刚在Gemfile中注意到了这一点

gem 'sqlite3', :group => [:development, :test]
gem 'pg', :group => [:production]

这是否意味着我们正在使用pg进行生产,即使保存的yml是.sqlite3?

1 个答案:

答案 0 :(得分:2)

Heroku不允许在生产中使用sqlite3。

https://devcenter.heroku.com/articles/sqlite3

您必须切换到PG。

使用以下方法检查数据库连接:

ActiveRecord::Base.connection.current_database

使用的适配器:

ActiveRecord::Base.connection.adapter_name