我一直在尝试设置一个测试数据库,但在尝试创建时,我一直遇到一个错误,在尝试填充数据库时我似乎无法通过。
执行时:
bundle exec rake db:create db:migrate db:test:prepare --trace
创建和迁移似乎在单独运行时运行没有错误,但是test:prepare似乎抛出错误。
错误始于:
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
** Invoke environment
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:load
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "capabilities" does not exist
LINE 5:
我抬起头,试了很多谷歌上显示的结果,但似乎都没有帮助。新的,所以我在这个阶段完全被困住了。
更新: 我应该提到:
rake db:create RAILS_ENV=test
->payments_test already exists
rake db:migrate RAILS_ENV=test
->rake aborted!
NoMethodError: undefined method `mq' for #<Rails::Application::Configuration:0x0000000508acf0> blah blah blah