Commit 43de8179 by 梁宇哲

Merge branch 'feature/batch_delete_notification_statistic_data' into 'master'

Feature/batch delete notification statistic data

See merge request !7
parents 6aaec300 67e00984
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_object = NotificationStatistic.where("notification_statistics.created_at < ?", '2020-05-30 16:00:00').last
first_id.step(last_object.id, 10000) do |i|
NotificationStatistic.where(id: [i...i+10000]).delete_all
end if last_object.present?
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