class DeleteNoneCourseHomework < 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 |h|
          if h.course_id.nil? || h.course.nil?
            h.destroy
          end
        end
      end
    end
  end

  def down
  end
end
