Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

rake db:migrate failed (Database "dev" does not exist) #5

Open
egor-sorokin opened this issue Jun 20, 2017 · 2 comments
Open

rake db:migrate failed (Database "dev" does not exist) #5

egor-sorokin opened this issue Jun 20, 2017 · 2 comments

Comments

@egor-sorokin
Copy link

I am mac user (OS X Sierra 10.12.5) and I tried to set up database, but got this error

galeria egorsorokin$ rake db:migrate
rake aborted!
ActiveRecord::NoDatabaseError: FATAL:  database "dev" does not exist
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in 'rescue in connect'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in 'connect'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in 'initialize'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in 'new'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in 'postgresql_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in 'new_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in 'checkout_new_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in 'acquire_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in 'block in checkout'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in 'checkout'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in 'block in connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in 'connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in 'retrieve_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in 'retrieve_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:916:in 'initialize'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in 'new'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in 'up'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in 'migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in 'migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in 'block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

After that I tried to create database "dev" by the command "rake db:create" or "rake db:create:all" and got this error

rake db:create
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: []
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:248:in 'resolve_symbol_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:211:in 'resolve_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:139:in 'resolve'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:169:in 'spec'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:50:in 'establish_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:109:in 'create_current'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:17:in 'block (2 levels) in <top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

I spent some hours to resolve this problem but didn't find a right solution on stackoverflow and github. Usually people who faced it recommend to check "database.yml", but looks like it's OK. Any ideas how to resolve it? Without it I can't continue the course

@quentinl-c
Copy link

It's the same issue for me.

@ghost
Copy link

ghost commented Dec 3, 2017

same here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants