class ForgeActivituesDate < ActiveRecord::Migration def up forge_count = ForgeActivity.all.count / 30 + 2 transaction do for i in 1 ... forge_count do i ForgeActivity.page(i).per(30).each do |activity| unless activity.forge_act_type == "ProjectCreateInfo" if activity.forge_act unless activity.forge_act.project # puts activity.id activity.destroy end else # puts activity.id.to_s + "----" activity.destroy end end end end end end def down end end