class UpdateHomeworkCommonUpdatedAt < ActiveRecord::Migration
  def up
    count = HomeworkCommon.all.count / 30 + 2
    transaction do
      for i in 1 ... count do i
        HomeworkCommon.page(i).per(30).each do |hw|
          ca = CourseActivity.where("course_act_type = 'HomeworkCommon' and course_act_id = #{hw.id}").first
          unless ca.nil?
            hw.update_attributes(:updated_at => ca.updated_at)
          end
        end
      end
    end
  end

  def down
  end
end
