From 793a98ade12e33b93fe824a06785d3e5eb8363bf Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 18 Dec 2015 15:51:41 +0800 Subject: [PATCH] =?UTF-8?q?forge=5Factivities=E9=82=A3=E4=B8=AA=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=84=9A=E6=9C=AC=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...18022014_batch_delete_project_journal_activities.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/db/migrate/20151218022014_batch_delete_project_journal_activities.rb b/db/migrate/20151218022014_batch_delete_project_journal_activities.rb index 95d6a39c5..6752b5b30 100644 --- a/db/migrate/20151218022014_batch_delete_project_journal_activities.rb +++ b/db/migrate/20151218022014_batch_delete_project_journal_activities.rb @@ -1,7 +1,15 @@ # encoding: utf-8 class BatchDeleteProjectJournalActivities < ActiveRecord::Migration def up - ForgeActivity.where('forge_act_type = \'Journal\'').destroy_all #需要触发回调 + #ForgeActivity.where('forge_act_type = \'Journal\'').destroy_all #需要触发回调 + count = ForgeActivity.where('forge_act_type = \'Journal\'').count / 30 + 2 + transaction do + for i in 1 ... count do i + ForgeActivity.where('forge_act_type = \'Journal\'').page(i).per(30).each do |activity| + activity.destroy + end + end + end end def down