18 lines
359 B
Ruby
18 lines
359 B
Ruby
|
class DeleteNullCourseActivity < ActiveRecord::Migration
|
||
|
def up
|
||
|
count = CourseActivity.all.count / 30 + 2
|
||
|
transaction do
|
||
|
for i in 1 ... count do i
|
||
|
CourseActivity.page(i).per(30).each do |activity|
|
||
|
unless activity.course_act
|
||
|
activity.destroy
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
end
|
||
|
end
|