3
votes

So, had a working postgres db instance with my rails app on my development Mac, but the migrations were getting unmanageable as I'm building the model up from scratch (i.e. adding, removing, changing columns), so I decided to start clean. After running rake db:drop, I can not recreate via rake db:create. I simply get the following:

Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"xyz_development", "pool"=>5, "username"=>"xyz", "password"=>nil}

I am thinking I need to create the user in postgres, but shouldn't it be there from initial setup?

Thanks.

2
You should show us the real SQL error that was thrown in the background.a_horse_with_no_name

2 Answers

1
votes

You should see the SQL statement to create the database in the log output, and probably also the error. Check that.

Also check that the database doesn't already exist. Try creating the database manually using psql(1) with the username/password you use in rails and see what happens.

0
votes
$ createdb xyz_development

Use the postgres bin createdb