Heroku +西纳特拉 +数据映射器
我在将 Sinatra + DataMapper 应用程序部署到 Heroku 时遇到问题。该应用程序可以在本地运行,但部署时会崩溃。
错误如下:
不推荐使用带有显式 :serial 选项的 Integer id,请改用 Serial (./hello.rb:15) /home/slugs/339253_c667ceb_65a5-45e31e8c-0236-4d03-96ec-a59bdabdf788/mnt/.gems/gems/dm-migrations-1.0.2/lib/dm-migrations/adapters/dm-postgres-adapter.rb:84: in `property_schema_hash': bad value for range (ArgumentError)
代码如下所示:
Class Post
include DataMapper::Resource
property :id, Integer, :serial => true
property :title, String
end
Post.auto_migrate!
first_post = Post.new
first_post.title = "First!"
first_post.save
这是一个 gem 版本控制问题,还是我遗漏了一些东西?
Im getting issues deploying my Sinatra + DataMapper app to Heroku. The app works locally but deploying it blows up.
Here's the error:
Integer id with explicit :serial option is deprecated, use Serial instead (./hello.rb:15)
/home/slugs/339253_c667ceb_65a5-45e31e8c-0236-4d03-96ec-a59bdabdf788/mnt/.gems/gems/dm-migrations-1.0.2/lib/dm-migrations/adapters/dm-postgres-adapter.rb:84:in `property_schema_hash': bad value for range (ArgumentError)
The code looks like this:
Class Post
include DataMapper::Resource
property :id, Integer, :serial => true
property :title, String
end
Post.auto_migrate!
first_post = Post.new
first_post.title = "First!"
first_post.save
Is this a gem versioning issue, or am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您似乎在本地使用了另一个版本的 datamapper 。
使用以下命令检查本地版本:
gem list --local
还可以使用 Serial 而不是建议的 Integer。
You use another version of datamapper locally it seems.
Check your local version with:
gem list --local
Also use Serial instead of Integer as proposed.
试试这个:
Try this instead:
您在本地和 Heroku 上使用相同版本的 DM 吗?
Do you use the same version of DM locally and on heroku?
您是否进行了捆绑安装,然后提交了 Gemfile 和 Gemfile.lock?如果不是heroku,就不知道您想使用哪些宝石,因此只需使用它的默认系统宝石。我猜他们不太匹配,这就是它爆炸的原因。
Did you do Bundle Install and then commit your Gemfile and Gemfile.lock? if not heroku woudln't have known which gems you wanted to use so just used it's default system gems. I guess they didn't quite match and that's why it exploded.