续集尝试使用 postgresql 而不是 postgres 作为适配器
有一个简单的heroku应用程序,带有sequel和postgres。但是,我得到:
% 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'
sequel-3.23.0/lib/sequel/adapters/ 中没有 postgresql.rb 我的本地驱动器上有一个 postgres.rb。我正在使用免费计划。
% 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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Sequel 始终使用“postgres”作为 postgres 适配器。如果您已指定“postgresql”作为适配器方案,那么它应该不起作用。如果您使用Rails,Heroku 会创建一个ActiveRecord 格式的database.yml 文件(使用“postgresql”),我猜这就是您的rake 任务正在获取的内容。如果您使用的是 Rails/Sequel 集成工具,我猜它不会为您处理该转换,并且应该修复它。就个人而言,我会使用 Heroku 提供的 DATABASE_URL 环境变量手动设置数据库连接。
有关详细信息,请参阅 http://devcenter.heroku.com/articles/database#database_urls。
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.
为了补充 Jeremy 的回复,Heroku 始终在
DATABASE_URL
中使用“postgres”。如果您连接到ENV["DATABASE_URL"]
,则无论您的数据库是什么,它都应该可以工作。Just to supplement Jeremy's response, Heroku has always used "postgres" in the
DATABASE_URL
. If you connect toENV["DATABASE_URL"]
, it should work regardless of what your database is.