Rails 春季更新后无法运行迁移 [英] Couldn't run migration after spring update in Rails
本文介绍了Rails 春季更新后无法运行迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在运行任何迁移时遇到错误:
I am facing a error when I run any migration as:
raj@notebook-pc:~/Desktop/Projects/invoicemanagement$ rails g migration RemoveDescriptionOfGoodsFromInvoiceDetails description_of_goods:string
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/var/lib/gems/1.9.1/gems/bundler-1.9.0/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.3, but your Gemfile requires spring 1.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /var/lib/gems/1.9.1/gems/bundler-1.9.0/lib/bundler/runtime.rb:19:in `setup'
** 11 stack trace lines skipped **
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
因此,通过一些谷歌搜索,我运行了 bundle update spring,它解决了上述错误,并且我能够删除/添加迁移.同样,如果我运行 rake db:migrate,我会收到如下错误:
So with some googling I run bundle update spring, which solved the above error, and I am able to remove/add migrations. Again if I run rake db:migrate, I am getting error as:
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `to_sym' for nil:NilClass/var/lib/gems/1.9.1/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:216:in `column'
** 33 stack trace lines skipped **
/var/lib/gems/1.9.1/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
请帮帮我.
推荐答案
在运行 bundle update
和更新 Spring 后,我在运行控制台时收到以下错误:
After running bundle update
and updating Spring, I was getting the following error when running the console:
There is a version mismatch between the spring client and the server.
You should restart the server and make sure to use the same version.
CLIENT: 1.3.4, SERVER: 1.3.3
我遵循了这个 Github 问题中的建议并运行:
I followed the recommendations in this Github issue and ran:
spring stop
这为我解决了这个问题.
This fixed the issue for me.
这篇关于Rails 春季更新后无法运行迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文