Rake db: migrate и db: создать не работает с соответствующими файлами базы данных

Я знаю, что этот вопрос возник до stackoverflow раньше, и я попробовал различные предлагаемые решения, даже пытаясь перезапустить мое текущее приложение. Но никто из них не работал. Я пытаюсь изменить мою базу данных на postgres. Вот мой файл database.yml:

development:
 aadapter: postgresql
 database: development
 pool: 5
 timeout: 5000
 host: localhost

test:
 adapter: postgresql
 database: test
 pool: 5
 timeout: 5000

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

мой gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'



gem 'pg'


# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
 # bundle exec rake doc:rails generates the API under doc/api.
 gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
gem 'debugger', group: [:development, :test]

gem 'omniauth'
gem 'omniauth-facebook', '1.4.0'

Я удалил approriate-зависимости в моем Gemfile.lock и изменил переменную RAILS_ENV. Не повезло в любое время. Вот мой след:

rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
database configuration does not specify adapter
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:52:in 'resolve_hash_connection'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:46:in 'resolve_string_connection'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:30:in 'spec'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:39:in 'establish_connection'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:175:in 'block (2 levels) in <class:railtie>'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in 'instance_eval'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in 'execute_hook'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:28:in 'block in on_load'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in 'each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in 'on_load'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:173:in 'block in <class:railtie>'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in 'instance_exec'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in 'run'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in 'block in run_initializers'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in 'block in tsort_each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in 'block (2 levels) in each_strongly_connected_component'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in 'each_strongly_connected_component_from'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in 'block in each_strongly_connected_component'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in 'each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in 'each_strongly_connected_component'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in 'tsort_each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in 'run_initializers'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in 'initialize!'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in 'method_missing'
/Users/fuzzyliz/rails_projects/roommaker/config/environment.rb:5:in '<top (required)="">'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in 'require'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in 'block in require'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in 'load_dependency'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in 'require'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in 'require_environment!'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in 'block in run_tasks_blocks'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in 'call'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in 'block in execute'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in 'each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in 'execute'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in 'block in invoke_with_call_chain'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in 'mon_synchronize'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in 'invoke_with_call_chain'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in 'block in invoke_prerequisites'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in 'each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in 'invoke_prerequisites'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in 'block in invoke_with_call_chain'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in 'mon_synchronize'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in 'invoke_with_call_chain'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in 'invoke'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in 'invoke_task'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in 'block (2 levels) in top_level'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in 'each'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in 'block in top_level'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in 'run_with_threads'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in 'top_level'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in 'block in run'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in 'standard_exception_handling'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in 'run'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.1.0/bin/rake:33:in '<top (required)="">'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/bin/rake:23:in 'load'
/Users/fuzzyliz/.rbenv/versions/2.0.0-p247/bin/rake:23:in '</top></top></class:railtie></class:railtie><main><code>'
Tasks: TOP => db:migrate => environment
</code> </main>
1 ответ

Я считаю, что у вас может возникнуть проблема из-за опечатки в определении вашего развития.

Также в качестве предложения я попытался бы определить немного больше в вашей базе данных.yml. Я не уверен, что требуется кодирование или какие минимальные параметры, но вот что типичное определение выглядит для моих проектов PG

development:
 adapter: postgresql
 encoding: unicode
 database: development
 pool: 5
 username: postgres
 password: postgres

licensed under cc by-sa 3.0 with attribution.