2015-12-18 10:48:13 +08:00
|
|
|
# encoding: utf-8
|
|
|
|
class BatchDeleteProjectJournalActivities < ActiveRecord::Migration
|
|
|
|
def up
|
2015-12-18 15:51:41 +08:00
|
|
|
#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
|
2015-12-18 10:48:13 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|