我转移到macports并尝试运行rake db:migrate,但是获取
$ rake db:migrate(in /Users/me/work/myproject)
rake aborted!
Mysql::Error: Table 'myproject_development.users' doesn't exist: SHOW FIELDS FROM `users`
我想它可能是我的database.yml?因为我现在正在使用macports和mysql5,所以我需要改变什么。在此之前,我唯一做的就是使用CocoaMySql来创建我的db myproject_development。
development:
adapter: mysql
encoding: utf8
reconnect: false
database: myproject_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
encoding: utf8
reconnect: false
database: myproject_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql
encoding: utf8
reconnect: false
database: myproject_production
pool: 5
username: root
password:
socket: /tmp/mysql.sock
//////// rake db:migrate --trace //////////////
的结果 rake db:migrate --trace
(in /Users/me/work/myproject)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Mysql::Error: Table 'myproject_development.users' doesn't exist: SHOW FIELDS FROM `users`
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:469:in `columns'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1271:in `columns'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1284:in `column_names'
/opt/local/lib/ruby/gems/1.8/gems/searchlogic-2.5.4/lib/searchlogic/named_scopes/ordering.rb:33:in `ordering_condition_details'
/opt/local/lib/ruby/gems/1.8/gems/searchlogic-2.5.4/lib/searchlogic/named_scopes/ordering.rb:25:in `create_condition'
/opt/local/lib/ruby/gems/1.8/gems/searchlogic-2.5.4/lib/searchlogic/named_scopes/or_conditions.rb:28:in `create_condition'
/opt/local/lib/ruby/gems/1.8/gems/searchlogic-2.5.4/lib/searchlogic/named_scopes/column_conditions.rb:63:in `respond_to?'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1481:in `respond_to?'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:183:in `flatten'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:183:in `observed_classes'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:166:in `initialize'
/opt/local/lib/ruby/1.8/singleton.rb:94:in `new'
/opt/local/lib/ruby/1.8/singleton.rb:94:in `instance'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:38:in `instantiate_observers'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:36:in `each'
/Users/me/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:36:in `instantiate_observers'
/Users/me/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:15:in `define_dispatcher_callbacks'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `evaluate_method'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `send'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
/Users/me/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `send'
/Users/me/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
/Users/me/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:631:in `prepare_dispatcher'
/Users/me/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:185:in `process'
/Users/me/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/Users/me/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/Users/me/work/myproject/config/environment.rb:14
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/me/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/me/.gem/ruby/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/local/bin/rake:19:in `load'
/opt/local/bin/rake:19
答案 0 :(得分:0)
你做过rake db:create:all
吗?
答案 1 :(得分:0)
您的应用无法找到mysql表。
基本上它意味着一些事情:
检查所有这些,你可能会发现你的数据库出了什么问题。一些额外的指示: