How to avoid exception when starting app without database created
PikachuEXE opened this issue · 4 comments
PikachuEXE commented
Calling rake db:create
or rake db:migrate
when database does not exist yet
would raise the following error
/Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:855:in `initialize': FATAL: database "spacious_staging" does not exist
(PG::ConnectionBad)
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:855:in `new'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:855:in `connect'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:556:in `initialize'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/connection_handling.rb:53:in `connection'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/model_schema.rb:208:in `columns'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.8/lib/active_record/model_schema.rb:254:in `column_names'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/traco-3.1.2/lib/traco/class_methods.rb:8:in `locales_for_attribute'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/traco-3.1.2/lib/traco/class_methods.rb:15:in `block in locale_columns'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/traco-3.1.2/lib/traco/class_methods.rb:14:in `each'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/traco-3.1.2/lib/traco/class_methods.rb:14:in `inject'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/traco-3.1.2/lib/traco/class_methods.rb:14:in `locale_columns'
from /Users/PikachuEXE/Projects/spacious-rails/app/controllers/internal/audit/buildings_controller.rb:6:in `<class:BuildingsController>'
from /Users/PikachuEXE/Projects/spacious-rails/app/controllers/internal/audit/buildings_controller.rb:3:in `<module:Audit>'
from /Users/PikachuEXE/Projects/spacious-rails/app/controllers/internal/audit/buildings_controller.rb:2:in `<module:Internal>'
from /Users/PikachuEXE/Projects/spacious-rails/app/controllers/internal/audit/buildings_controller.rb:1:in `<top (required)>'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:424:in `load'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:424:in `block in load_file'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:616:in `new_constants_in'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:423:in `load_file'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:324:in `require_or_load'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:289:in `depend_on'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:207:in `require_dependency'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/engine.rb:464:in `each'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/engine.rb:464:in `block in eager_load!'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/engine.rb:462:in `each'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/engine.rb:462:in `eager_load!'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/engine.rb:347:in `eager_load!'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/application/finisher.rb:56:in `each'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/initializable.rb:30:in `run'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/railties-4.0.8/lib/rails/application.rb:215:in `initialize!'
from /Users/PikachuEXE/Projects/spacious-rails/config/environment.rb:5:in `<top (required)>'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `block in require'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:92:in `preload'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /Users/PikachuEXE/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/PikachuEXE/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
henrik commented
Hm. This is Traco 3.1.2 so I guess it's not a new issue introduced by the largish rewrite in 3.1.3.
I suspect you'll still get it with a newer Traco but try that if you like.
I won't have time to look into this today, but maybe tomorrow or Friday.
PikachuEXE commented
Not urgent, I reverted to 3.1.2
for now.
nashbridges commented
@PikachuEXE please, point your Gemfile to
gem "traco", "~> 3.1", github: "nashbridges/traco", ref: "026c0600"
and we'll see if it helps.
PikachuEXE commented
@nashbridges That works!