Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with rake: "development database is not configured"

I am novice rails/terminal user and just did a clean install of Lion + Xcode + Rails. Unlike before (on Snow Leopard), I now get an error running rake db:migrate.

I have cloned my code through git which worked fine and created the database witht the "createdb" command but when I try run "rake db:migrate" in terminal it now comes up with this error:

rake aborted!
development database is not configured

My config/database.yml file looks like below in the development section which is exactly the way it looked before on Snow Leopard where it worked fine, so don't know if the error I am now getting is related to Lion.

development:  
adapter: postgresql
database: my_db
username: rasmus
encoding: utf8
pool: 5

Can anyone help, please?

like image 231
rassom Avatar asked Jul 23 '11 16:07

rassom


3 Answers

I got the same error and in my case it was because the database.yml was not indented correctly. All the configuration parameters should be indented.

like image 66
Nishith Avatar answered Nov 02 '22 23:11

Nishith


Note, be sure to follow the proper spacing conventions. The database config is whitespace aware. Two spaces per attribute works fine. In the following code, note how each attribute has two spaces. Do not use tabs. If you don't use spaces for attributes, rake will not work and throw the same error.

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  encoding: unicode
  database: db/production
  pool: 5
  timeout: 5000
  password:
like image 31
tshm001 Avatar answered Nov 02 '22 23:11

tshm001


You might also want to look for syntax errors in the file. This is the error that will appear if you have a syntax error in your config/database.yml file and you try to do something like start the local web server or run rake db:migrate.

In my case I had accidentally removed the comment from a line at the top of the file and I was seeing this error since the uncommented line made this an invalid yml file.

like image 2
SnapShot Avatar answered Nov 03 '22 00:11

SnapShot