奇怪的错误。所有帮助表示赞赏。
这是我的 database.yml
development:
adapter: postgresql
encoding: unicode
database: app_development
pool: 5
username: username
password:
test:
adapter: postgresql
encoding: unicode
database: app_test
pool: 5
username: username
password:
production:
adapter: postgresql
encoding: unicode
database: app_production
pool: 5
username: username
password:
例如,当我手动创建数据库并尝试使用它们时,rake db:test:preare
我收到以下错误:
FATAL: database "postgres" does not exist
当我尝试删除数据库时,出现以下错误:
Couldn't drop app_development : #<PG::Error: FATAL: database "postgres" does not exist
>
Couldn't drop app_test : #<PG::Error: FATAL: database "postgres" does not exist
>
Couldn't drop app_production : #<PG::Error: FATAL: database "postgres" does not exist
如果我尝试通过 with 创建数据库,rake db:create:all
则会收到以下错误:
app_development already exists
app_test already exists
app_production already exists
所以看来我的 database.yml 没问题。但由于某种原因,它正在寻找一个名为 postgres 的数据库,而这不是我的 database.yml 中的内容。
任何帮助表示赞赏。
编辑:
这里更多来自 rake 的踪迹:
无法为 {"adapter"=>"postgresql"、"encoding"=>"unicode"、"database"=>"app_production"、"pool"=>5、"username"=>"username" 创建数据库“密码”=>无}