sequel trying to use postgresql instead of postgres as adapters

拟墨画扇 提交于 2019-12-11 04:05:55

问题


Had a simple heroku app with sequel and postgres. However, I got:

% heroku rake db:migrate
rake aborted!
LoadError: no such file to load -- sequel/adapters/postgresql
/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.23.0/lib/sequel/core.rb:249:in `require'

There is no postgresql.rb in the sequel-3.23.0/lib/sequel/adapters/ There is a postgres.rb on my local drive. I'm using the free plan.

% heroku info
...
Dynos:          1
Workers:        0
Repo size:      9M
Slug size:      8M
Stack:          bamboo-mri-1.9.2
Data size:      (empty)
Addons:         Basic Logging, Shared Database 5MB


% heroku pg:info
=== kampanchi database SHARED_DATABASE_URL

回答1:


Sequel has always used "postgres" for the postgres adapter. If you have specified "postgresql" as the adapter scheme, then it shouldn't work. If you are using Rails, Heroku creates a database.yml file in ActiveRecord format (using "postgresql"), and I'm guessing that's what your rake task is picking up. If you are using a Rails/Sequel integration tool, I'm guessing it isn't handling that conversion for you, and it should be fixed. Personally, I'd manually set up the database connection using the DATABASE_URL environment variable that Heroku provides.

See http://devcenter.heroku.com/articles/database#database_urls for details.




回答2:


Just to supplement Jeremy's response, Heroku has always used "postgres" in the DATABASE_URL. If you connect to ENV["DATABASE_URL"], it should work regardless of what your database is.



来源:https://stackoverflow.com/questions/6116503/sequel-trying-to-use-postgresql-instead-of-postgres-as-adapters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!