rake db:test:clone RAILS_ENV =" test"失败,奇数错误:数据库配置未指定适配器

时间:2014-03-14 11:06:03

标签: ruby-on-rails

我正在运行rake db:test:clone RAILS_ENV="test"并收到错误:database configuration does not specify adapter

我的database.yml如下:

development:
  adapter: postgresql
  encoding: unicode
  host: localhost
  database: mydb_development
  username: mydbuser
  password:
  allow_concurrency: true
  pool: 5
  min_messages: warning

test:
  adapter: postgresql
  encoding: unicode
  host: localhost
  database: mydb_test
  username: mydbuser
  password:
  pool: 5

PS。 rake db:test:prepare RAILS_ENV="test"会返回相同的错误。

On" test"我不确定是否需要主机。我删除了它并再次尝试以防万一。有什么想法吗?

更新

当我执行rake db:create:all时,我收到通知:

mydb_development already exists

它是否还假设还返回mydb_test已经存在?

我运行bundle exec rake db:create RAILS_ENV=test并遇到同样的错误。

2 个答案:

答案 0 :(得分:4)

尝试在实际命令

之前设置环境变量
RAILS_ENV="test" rake db:test:clone

答案 1 :(得分:2)

根据我们的IRC对话!

rake db:drop
rake db:create

RAILS_ENV=test rake db:create
RAILS_ENV=test rake db:migrate
相关问题