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