You can create a Rake task in lib/tasks/:
namespace :db do
desc 'Make migration with output'
task(:migrate_with_sql => :environment) do
ActiveRecord::Base.logger = Logger.new(STDOUT)
Rake::Task['db:migrate'].invoke
end
end
Then call rake db:migrate_with_sql to log the migration.