How do you disable db:migrate when doing a cap deploy:cold
with Capistrano?
In config/deploy.rb the only reference to deploy:migrate
is commented out but it's still attempting to do:
bundle exec rake RAILS_ENV=production db:migrate
How do you disable db:migrate when doing a cap deploy:cold
with Capistrano?
In config/deploy.rb the only reference to deploy:migrate
is commented out but it's still attempting to do:
bundle exec rake RAILS_ENV=production db:migrate
I got success by overriding the deploy:migrate
method in my config/deploy.rb
.
namespace :deploy do
desc "No ActiveRecord override"
task :migrate do
end
end
When re-defining a task in Capistrano v2, the original task was replaced. However the Rake DSL on which Capistrano v3 is built is additive. According to documentation. Under most circumstances, you will simply want to use clear_actions, which removes the specified task’s behaviour, but does not alter it’s dependencies or comments:
namespace :deploy do
Rake::Task["migrate"].clear_actions
task :migrate do
puts "no migration"
end
end
I had the same problem. That's why I override it in the Rakefile. Like this:
namespace :db do
desc "db:migration fakes"
task :migrate => :environment do
p 'No. We will not migrate!'
end
end
Here you can add more logic if you like. You could for example trigger a real migration on certain environments.