Database configuration error does not indicate adapter error using PG gem in Rails 3.2

When I run "rake db: migrate", I get the error "Database configuration does not indicate an adapter."

Here is my database.yml:

development:  adapter: postgresql  database: development  username: ##########  password: ##########  host: localhost  pool: 5  timeout: 5000 

My Gemfile Lists:

 gem 'pg' 
+4
source share
4 answers

I found out what it was. I picked up the .yml database for myself, and it put in a ton of invisible characters that prevented YAML from reading.

+12
source

In my case

 RAILS_ENV=development rake db:migrate 

did the trick.

+8
source

Are you sure you set up your development environment?

This is export RAILS_ENV=development on my mac.

+4
source

I also got this error after some recent changes in my Rails application. At first the error appeared in unicorn logs, so I tried to run rake db:setup and got an error there.

In my case, I somehow got the extra space located before the test database definition. So my database.yml looked like this:

 ... test: adapter: postgresql ... production: adapter: postgresql ... 

instead of this:

 ... test: adapter: postgresql ... production: adapter: postgresql ... 

I deleted the space and fixed the problem.

0
source

Source: https://habr.com/ru/post/1402579/


All Articles