Commit cb8dd3b0 by 梁宇哲

Merge branch 'feature/batch_delete_notification_statistic_data' into 'master'

删除rake 任务

See merge request !9
parents c0eaed2e eb6f5f45
namespace :data_migrations do
namespace :version do
desc "batch delete notification_statistics data"
task :v1_batch_delete_notification_statistics_data => :environment do
last_object = NotificationStatistic.where("notification_statistics.created_at >= ?", '2020-05-30 16:00:00').first
puts "rake begin time is #{Time.now.to_s}"
NotificationStatistic.in_batches(of: 10000, finish: last_object ) {|records| records.delete_all} if last_object.present?
puts "rake end time is #{Time.now.to_s}"
end
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment