Our rails app (3.2.12) has two databases, a content database and an user database. How can I override deploy:migrate (rakefile here) so that during a "cap production deploy:cold" migrations are correspondingly run for their both the target databases.
essentially it should do this during deploy
** transaction: commit
* 2013-10-16 02:26:15 executing `deploy:migrate'
* executing "cd /home/deployer/apps/project/releases/20131015152439 && bundle exec rake RAILS_ENV=production db:migrate"
* executing "cd /home/deployer/apps/project/releases/20131015152439 && bundle exec rake RAILS_ENV=production user:db:migrate"
Any help will be much appreciated.
Edit: I did replace the task with my own task in the deploy namespace
namespace :deploy do
set :migration_role, fetch(:migration_role, :db)
task :migrate do
on primary fetch(:migration_role) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, "db:migrate"
execute :rake, "user:db:migrate"
end
end
end
end
after 'deploy:updated', 'deploy:migrate'
end
This throws an error "undefined method `primary'".