无法rake db:migrate ArgumentError:Fixnum与String的比较失败

时间:2014-05-01 05:44:35

标签: mysql rake

这是我见过的最奇怪的错误。

我尝试使用应用服务器和远程数据库服务器部署rails。 我可以运行rails dbconsole并从应用服务器登录到数据库。 我也可以正常运行rake db:drop && rake db:create但是当我运行rake db:migrate时,所有地狱都会因为在处理迁移数据库之前从未见过的错误而丢失。我打赌这是一个我没有看到的简单修复,但请看看并告诉我我能解决这个问题。谢谢所有试过的人!

我可以在我的本地计算机上运行db:migrate并且它运行正常但是当我部署时我得到:

rake aborted!
ArgumentError: comparison of Fixnum with String failed

ArgumentError: comparison of Fixnum with String failed

ArgumentError: comparison of String with 0 failed

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

然后我用跟踪运行它仍然没有给我任何想要修复它

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
ArgumentError: comparison of Fixnum with String failed
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:366:in `<'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:366:in `add'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:452:in `error'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:428:in `rescue in log'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:425:in `log'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:286:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/mysql2_adapter.rb:220:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:300:in `execute_and_free'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:414:in `tables'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:421:in `table_exists?'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/schema_migration.rb:17:in `create_table'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:878:in `initialize'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `new'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:240:in `call'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:240:in `block in execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:235:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:235:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:165:in `invoke'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:150:in `invoke_task'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `block in top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:115:in `run_with_threads'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:100:in `top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:78:in `block in run'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:75:in `run'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/bin/rake:33:in `<top (required)>'
/home/apps/.rbenv/versions/2.1.0/bin/rake:23:in `load'
/home/apps/.rbenv/versions/2.1.0/bin/rake:23:in `<main>'
ArgumentError: comparison of Fixnum with String failed
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:366:in `<'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:366:in `add'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:452:in `error'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/log_subscriber.rb:85:in `rescue in finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/log_subscriber.rb:83:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:96:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40:in `block in finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:36:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:25:in `instrument'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:420:in `log'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:286:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/mysql2_adapter.rb:220:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:300:in `execute_and_free'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:414:in `tables'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:421:in `table_exists?'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/schema_migration.rb:17:in `create_table'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:878:in `initialize'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `new'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:240:in `call'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:240:in `block in execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:235:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:235:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:165:in `invoke'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:150:in `invoke_task'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `block in top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:115:in `run_with_threads'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:100:in `top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:78:in `block in run'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:75:in `run'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/bin/rake:33:in `<top (required)>'
/home/apps/.rbenv/versions/2.1.0/bin/rake:23:in `load'
/home/apps/.rbenv/versions/2.1.0/bin/rake:23:in `<main>'
ArgumentError: comparison of String with 0 failed
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:273:in `<='
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/logger.rb:273:in `debug?'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/log_subscriber.rb:37:in `sql'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/subscriber.rb:68:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/log_subscriber.rb:83:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:96:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40:in `block in finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:36:in `finish'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:25:in `instrument'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:420:in `log'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:286:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/mysql2_adapter.rb:220:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:300:in `execute_and_free'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:414:in `tables'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:421:in `table_exists?'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/schema_migration.rb:17:in `create_table'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:878:in `initialize'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `new'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:240:in `call'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:240:in `block in execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:235:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:235:in `execute'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/task.rb:165:in `invoke'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:150:in `invoke_task'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `each'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:106:in `block in top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:115:in `run_with_threads'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:100:in `top_level'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:78:in `block in run'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/lib/rake/application.rb:75:in `run'
/home/apps/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.2.2/bin/rake:33:in `<top (required)>'
/home/apps/.rbenv/versions/2.1.0/bin/rake:23:in `load'
/home/apps/.rbenv/versions/2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate

1 个答案:

答案 0 :(得分:1)

Face Palm。

我在我的环境文件中有这个并且导致了问题:

config.logger = Logger.new(STDOUT)
config.logger.level = 'DEBUG'

config.logger.level = 'DEBUG'更改为config.log_level = 'DEBUG'

一切都很顺利。