Using PostgreSQL with Rails 3, Cucumber & RSpec
One thing that tripped me up when trying to set up a new project using PostgreSQL rather than sqlite3, is that when running rake db:test:prepare I got the error message:
/path/to/rake:19:in `<main>'
Couldn't create database for
{"adapter"=>"postgresql", "encoding"=>"unicode",
"database"=>"myproject_test", "host"=>"localhost",
"pool"=>5, "username"=>"moi", "password"=>nil, "min_messages"=>"WARNING"}
rake aborted!
FATAL: database "test" does not exist
This despite having just run createdb -O moi test
I recreated the database, checked that it was, in fact, there (psql myproject_test, and ran the rake command again. Boom. Same error message.
Turns out the user “moi” was allowed to drop databases, but not create them.
psql myproject_development; ALTER USER moi CREATEDB; \q
Et voila.
October 25, 2011 at 7:25 PM
Thanks, I was pulling my hair out over this issue!
July 20, 2011 at 7:28 PM
Yep. Just crossed this issue today. :] Thanks for posting!
http://dazedthots.blogspot.com/