0

So I seemingly successfully installed postgres for production for heroku deployment, but locally rails seems to not find/nor create the database.

When I go to localhost:3000 I get the error:

ActiveRecord::NoDatabaseError
FATAL: database "dimension_development" does not exist Run `$ bin/rake db:create db:migrate` to create your database

When I run $bin/rake db:create I get:

~ already exists

Then, run db:migrate and restart the rails server, reload the page, and get same error.

So I tried instead to run $bin/rake db:create:all and got:

~ already exists
dimension_test already exists
dimension_production already exists

Then did db:migrate again but nothing changed.

If they already exist, why isn't rails finding them? I notice that in the config/db folder there is still the old development.sqlite3 file but no postgres file.

Any idea what could be going on to cause this error?

My database.yml is:

development:
  adapter: postgresql
  database: dimension_development
  pool: 5
  timeout: 5000
test:
  adapter: postgresql
  database: dimension_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: dimension_production
  pool: 5
  timeout: 5000

Thanks! This has got me stumped and I haven't been able to find anything on stackoverflow dealing with this pitfall.

2
  • 1
    In case of postgresql you will not find any file like development.sqlite3. It's in case of sqlite only. You did not provided database credential in your database.yml file might causing this error. Try pass username and password as well. Commented Dec 19, 2014 at 6:04
  • That was it! Thanks so much Dipak, makes my life much easier :D Commented Dec 19, 2014 at 7:08

1 Answer 1

2

In case of postgresql you will not find any file like development.sqlite3. It's in case of sqlite only.

You did not provided database credential in your database.yml file might causing this error. Try pass username and password as well.

development:
  adapter: postgresql
  database: dimension_development
  pool: 5
  timeout: 5000
  username: xxxx
  password: xxxx
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.