I want to run all the migrations on all my databases. For this, I have
a task called run_migrations. Consider this code:
desc ‘Runs migrations on all databases’
task :run_migrations => :environment do
[
‘development’,
‘test’,
‘production’
].each do |environment|
ENV[‘RAILS_ENV’] = environment
Rake::Task[‘db:migrate’].execute(’’)
system “RAILS_ENV=#{environment} rake db:migrate”
end
end
This runs migrations only for the development database because further
calls to execute the task are ignored. Is there any way to force the
execution of the Rake task?
Regards,
Mohsin