我有一个问题。
我使用的是项目,它使用rails 2.3和ruby 1.8.7。我的任务 - 更新到rails 4.0.1。
但我之前需要测试这个应用程序。此应用程序没有迁移,因此我使用rake db:schema:load
但是当我启动此命令时,我看到此错误。
rake db:schema:load --trace
(in /home/alxgol/Projects/nucleus-core)
DEPRECATION WARNING: Rake tasks in vendor/plugins/find_conditions/tasks and vendor/plugins/ym4r_gm/tasks are deprecated. Use lib/tasks instead. (called from /home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/tasks/rails.rb:10)
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Mysql::Error: Table 'core_development.payments' doesn't exist: SHOW FIELDS FROM `payments`
我认为出现此问题是因为表payments
中的信息在创建此表之前调用。但我没有找到,这个电话在哪里
更新
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/connection_adapters/mysql_adapter.rb:471:in `columns'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:1305:in `columns'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:1318:in `column_names'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:1331:in `column_methods_hash'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:2025:in `all_attributes_exists?'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:406:in `all?'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:2025:in `each'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:2025:in `all?'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:2025:in `all_attributes_exists?'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activerecord-2.3.11/lib/active_record/base.rb:1876:in `method_missing_without_paginate'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/will_paginate-2.3.12/lib/will_paginate/finder.rb:170:in `method_missing'
/home/alxgol/Projects/nucleus-core/config/initializers/site_config.rb:15
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:171:in `load_without_new_constant_marking'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:171:in `load'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:171:in `load'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/initializer.rb:622:in `load_application_initializers'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/initializer.rb:621:in `each'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/initializer.rb:621:in `load_application_initializers'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/initializer.rb:176:in `process'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
/home/alxgol/Projects/nucleus-core/config/environment.rb:14
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.11/lib/tasks/misc.rake:4
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/home/alxgol/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/home/alxgol/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/gems/rake-0.8.7/bin/rake:31
/home/alxgol/.rvm/gems/ruby-1.8.7-head/bin/rake:23:in `load'
/home/alxgol/.rvm/gems/ruby-1.8.7-head/bin/rake:23
/home/alxgol/.rvm/gems/ruby-1.8.7-head/bin/ruby_executable_hooks:15
解
如果仔细查看错误,您会看到它引用了/home/alxgol/Projects/nucleus-core/config/initializers/site_config.rb:15。在此文件中是来自付款表的电话。我注释掉了这个,然后在那个rake db:schema:load完成了工作。
答案 0 :(得分:0)
如果仔细查看错误,您会看到它引用了/home/alxgol/Projects/nucleus-core/config/initializers/site_config.rb:15
。在这个文件中是从payments
表调用的。我评论了这一点,之后rake db:schema:load
完美地运作了。