Rake 数据库:迁移问题

发布于 2024-11-09 02:55:15 字数 1827 浏览 0 评论 0原文

在本地运行 rake db:create 或 rake db:migrate 时,我的应用程序按预期成功构建了表。然而,当在heroku上运行时(例如heroku rake db:migrate --trace --app ),它突然给我以下错误:

C:\>heroku rake db:migrate --trace --app foo rake aborted!
undefined method `task' for #<Foo::Application:0x7f8e77aa1420>
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:139:in `load_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
/app/Rakefile:7
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:78:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:61:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/bin/rake:31
/usr/ruby1.8.7/bin/rake:19:in `load'
/usr/ruby1.8.7/bin/rake:19

查看Rakefile,这就是当前的全部内容:

require File.expand_path('../config/application', __FILE__)
require 'rake'

Foo::Application.load_tasks

load_tasks行是第7行。我我真的不确定发生了什么变化,但确实发生了一些变化。有没有人有过这个错误的经验?

When running rake db:create or rake db:migrate locally my app successfully builds the tables as expected. When running on heroku however (eg. heroku rake db:migrate --trace --app ) it is giving me the following error all of a sudden:

C:\>heroku rake db:migrate --trace --app foo rake aborted!
undefined method `task' for #<Foo::Application:0x7f8e77aa1420>
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:139:in `load_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
/app/Rakefile:7
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:78:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:61:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/bin/rake:31
/usr/ruby1.8.7/bin/rake:19:in `load'
/usr/ruby1.8.7/bin/rake:19

Looking at the Rakefile this is all that's present:

require File.expand_path('../config/application', __FILE__)
require 'rake'

Foo::Application.load_tasks

The load_tasks line is line 7. I'm really not sure what changed but something sure has. Has anyone had experience with this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时模样 2024-11-16 02:55:15

请参阅

Rake 0.9 存在问题.0。现在在 Gemfile 中使用 0.8.7。

See that

There's an issue with Rake 0.9.0. Use 0.8.7 in your Gemfile for now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文