ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Can't rake db:migrate - Production and Test Database

Added by z1 ceres at 2013-04-23 04:35 pm

Hey guys, I got a situation here that I can't execute rake taks db:migrate for production and Test Database, but the weird thing here is that I successfully execute db:migrate for development. i set all database.yml settings the same way as the other except for identical database name. PLEASE HELP!

Here's the error log:

/home/xxx/.rvm/rubies/ruby-1.9.3-p392/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/xxx/.rvm/gems/ruby-1.9.3-p392@global/bin/rake db:migrate
rake aborted!
A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/session/cookie_store.rb:178:in `ensure_session_key'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/session/cookie_store.rb:81:in `initialize'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/middleware_stack.rb:72:in `new'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/middleware_stack.rb:72:in `build'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/middleware_stack.rb:116:in `block in build'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/middleware_stack.rb:116:in `each'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/middleware_stack.rb:116:in `inject'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/middleware_stack.rb:116:in `build'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:81:in `initialize'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:51:in `new'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/rails-2.3.18/lib/initializer.rb:631:in `prepare_dispatcher'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/rails-2.3.18/lib/initializer.rb:185:in `process'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/rails-2.3.18/lib/initializer.rb:113:in `run'
/home/xxx/Project_Files/ROR/Chiliproject_3.8.0_Production/config/environment.rb:42:in `<top (required)>'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:182:in `require'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:182:in `block in require'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:547:in `new_constants_in'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:182:in `require'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@chiliproject/gems/rails-2.3.18/lib/tasks/misc.rake:4:in `block in <top (required)>'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/xxx/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
-e:1:in `load'
-e:1:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

Process finished with exit code 1

39.png (148.2 kB)


Replies (1)

RE: Can't rake db:migrate - Production and Test Database - Added by Holger Just at 2013-04-24 03:12 pm

You need to have a secret key that is used to sign the session cookies. You can use this command to generate a random key which is written to config/initializers/session_store.rb:

bundle exec rake generate_session_store

As the application is fully loaded in production and test environments, you need that key there. In development mode, the application loads only what is actually required which might skip the session initialization for the migrations. In any case, for running the app, you need the secret.

(1-1/1)