我创建了一个迁移。我试图通过以下方式运行它:
rake db:migrate:up VERSION=
它引发了以下错误:
D, [2018-06-03T13:20:41.295098 #2257] DEBUG -- : ** [Raven] Sending event 2a32cb0c249acd2efde26ce6453a2d77 to Sentry
D, [2018-06-03T13:20:41.343397 #2257] DEBUG -- : ** [Raven] Raven HTTP Transport connecting to https://app.getsentry.com
rake aborted!
NoMethodError: undefined method `last_comment' for #<Rake::Application:0x007fb71d8a76a0>
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb:101:in `define'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb:78:in `initialize'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.2/lib/rspec/rails/tasks/rspec.rake:11:in `new'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.2/lib/rspec/rails/tasks/rspec.rake:11:in `<top (required)>'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-rails-3.0.2/lib/rspec-rails.rb:13:in `block in <class:Railtie>'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:237:in `instance_exec'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:245:in `each'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:245:in `each_registered_block'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/railtie.rb:237:in `run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/application.rb:437:in `block in run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine/railties.rb:13:in `each'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine/railties.rb:13:in `each'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/application.rb:437:in `run_tasks_blocks'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:453:in `load_tasks'
/Rakefile:6:in `<top (required)>'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:703:in `raw_load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:104:in `block in load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:103:in `load_rakefile'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:82:in `block in run'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/.rbenv/versions/2.1.2/bin/rake:23:in `load'
/.rbenv/versions/2.1.2/bin/rake:23:in `<main>'
我该如何处理?
答案 0 :(得分:0)
迁移时指定版本。这是好的,您只想迁移特定版本的迁移。如果要迁移所有挂起的迁移,可以说rake db:migrate。 示例:
rake db:migrate:up VERSION=20120820165642
答案 1 :(得分:0)
我必须对本地rails运行命令
rake db:migrate:up VERSION=20120820165642 RAILS_ENV=test
适合我