class UpdateHomeworkCommonPublishTime < 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 |homework|
          homework.publish_time = homework.created_at.strftime('%d-%b-%Y')
          homework.save
        end
      end
    end
  end

  def down
  end
end
