Suraj
Suraj

Reputation: 2563

'development' database is not configured

I am getting this error while doing rake db:migrate of newly cloned app.

'development' database is not configured. Available: ["production"]

So after reading the error, I am doing RAILS_ENV=production rake db:migrate

But this isn't working either.

My database.yml has

production:
adapter: postgresql
encoding: unicode
database: test
pool: 5
username: admin
password: admin
port: 5433

Please suggest.

Upvotes: 1

Views: 12058

Answers (2)

Daniel Okwufulueze
Daniel Okwufulueze

Reputation: 357

Your database.yml file shows you have only production environment configured for DB operations. You need to add configuration for development environment as well.

Open your database.yml file and add a configuration for development environment. Something like the following should suffice (contents in square brackets are to be replaced with your actual values):

development:
    adapter:[your adapter]
    encoding: [your encoding]
    database: [your database for development]
    pool: [your pool]
    username: [your database server username]
    password: [your database server password]
    port: [the port you're connecting on]

Remember to indent your yaml code appropriately.

Upvotes: 0

Andrey Deineko
Andrey Deineko

Reputation: 52367

Add

development:
  adapter: postgresql
  encoding: unicode
  database: test
  pool: 5
  username: admin
  password: admin
  port: 5433
  host: localhost

to database.yml file.

Also, if you test your application, you'll need test environment as well.

Upvotes: 0

Related Questions