我以前从未见过这个错误,我也不知道应该寻找什么。
$ rake db:migrate --trace
(in /Users/tscolari/Projetos/movies)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
stack level too deep
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `write'
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `collect'
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `write'
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `write'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:108:in `flush'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:101:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:101:in `flush'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:125:in `auto_flush'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:66:in `add'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:77:in `debug'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:201:in `log'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/sqlite_adapter.rb:180:in `tables'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:21:in `table_exists?'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:429:in `initialize_schema_migrations_table'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:487:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:433:in `new'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:433:in `up'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:415:in `migrate'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:142
/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: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
首先我认为在我的一次迁移中可能出现问题,所以我将它们全部删除以进行检查,错误仍然存在。 奇怪的是,应用程序/控制台启动没有任何问题:
$ rails server
=> Booting Mongrel
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
然后我不知道在哪里寻找错误。有什么帮助吗?
答案 0 :(得分:1)
好,
我尝试了所有内容,rake db:reset
,删除所有迁移,依此类推......
问题是一个宝石。我的 gemfile 中的scrubyt gem
导致了所有这些麻烦......
答案 1 :(得分:0)
在 Ubuntu 20.04
上开发 Rails 4 应用程序时,我遇到了类似的挑战当我运行命令 rake:db migrate
时,出现以下错误:
抽水中止!
SystemStackError:堆栈级别太深
/home/mycomputer/Projects/my-project/config/environment.rb:5:in <top (required)>' /home/mycomputer/.rbenv/versions/2.5.8/bin/bundle:23:in
load'
/home/mycomputer/.rbenv/versions/2.5.8/bin/bundle:23:in `'
任务:TOP => db:migrate => 环境
(通过使用 --trace 运行任务查看完整跟踪)
这是我修复它的方法:
经过几个小时的调试后,我认为问题是由一些过时的 gems 引起的,这些 gems 导致了一些依赖性问题。
我所做的只是使用以下命令将 gem 更新到与项目兼容的版本:
bundle update
您也可以注释掉 gem,然后在取消注释每个 gem 后尝试一个接一个地安装它们。如果您有幸追踪导致问题的 gem,那么您可以仅使用
更新该 gembundle update gem_name
另一种方法,虽然不明智(因为您可能会遇到一些依赖兼容性问题)是删除您的 Gemfile.lock
文件,然后使用以下方法重新安装您的 gem:
bundle install
或
bundle update
仅此而已。
我希望这会有所帮助
答案 2 :(得分:-1)
有时db会摆脱困境。您可以做的是保存当前架构,然后重置数据库rake db:reset
并进行新迁移script/generate migration add_old_db
迁移整个旧架构作为新迁移。只需将旧架构复制并粘贴到新迁移中,它就会像以前一样创建新表。当然,您的数据将在此过程中被销毁。