中止rake db:drop db:create db:migrate命令后,我无法再执行任何Rails或rake DB相关任务。 我已经尝试了几件事,但到目前为止没有任何效果(重新安装ruby,rails,rake,安装和更新包,删除db和架构文件等)。
这是我的数据库。yml:
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
adapter: mysql2
encoding: utf8
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
host: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>
这是db:drop的堆栈,例如:
$ rake db:drop --trace
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
^Crake aborted!
Interrupt:
/Users/user/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:21:in `[]'
/Users/user/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:93:in `[]'
/Users/user/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/notifications/fanout.rb:57:in `listeners_for'
/Users/user/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/notifications/fanout.rb:64:in `listening?'
/Users/user/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/notifications.rb:167:in `instrument'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:656:in `load_config_initializer'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:613:in `each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/engine.rb:613:in `block in <class:Engine>'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `instance_exec'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `run'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `call'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `each_strongly_connected_component_from'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/initializable.rb:60:in `run_initializers'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/application.rb:361:in `initialize!'
/Users/user/Documents/dev/workspaces/myProject/config/environment.rb:5:in `<main>'
/Users/user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/Users/user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/Users/user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/Users/user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/Users/user/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/Users/user/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/Users/user/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/Users/user/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/application.rb:337:in `require_environment!'
/Users/user/.rvm/gems/ruby-2.5.1/gems/railties-5.2.1/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:237:in `block in invoke_prerequisites'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:235:in `each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:235:in `invoke_prerequisites'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:212:in `block in invoke_with_call_chain'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:237:in `block in invoke_prerequisites'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:235:in `each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:235:in `invoke_prerequisites'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:212:in `block in invoke_with_call_chain'
/Users/user/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/Users/user/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/Users/user/.rvm/gems/ruby-2.5.1/bin/rake:23:in `load'
/Users/user/.rvm/gems/ruby-2.5.1/bin/rake:23:in `<main>'
/Users/user/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/Users/user/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => db:drop => db:load_config => environment
感谢任何帮助。谢谢!
答案 0 :(得分:0)
能否请您在指定当前Rails环境的情况下尝试运行命令?
样本:rake db:drop RAILS_ENV=development
答案 1 :(得分:0)
好的,老实说,我在这里写下答案有点as愧,但也可能对其他人有帮助! :D
根本原因是byebug ...我将Byebug.wait_connection = true设置为,但不知道这也会影响某些rake命令...