Commit 4aa1166b by liangyuzhe

批量删除统计表

parent 6aaec300
namespace :data_migrations do
namespace :version do
desc "batch delete notification_statistics data"
task :v1_batch_delete_notification_statistics_data => :environment do
first_id = NotificationStatistic.first.id
last_id = NotificationStatistic.where("notification_statistics.created_at < ?", '2020-04-30 16:00:00').last.id
first_id.step(last_id, 10000) do |i|
NotificationStatistic.where(id: [i...i+10000]).delete_all
end
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