18 lines
394 B
Ruby
18 lines
394 B
Ruby
class DeleteNullStudnetWorkProject < ActiveRecord::Migration
|
|
def up
|
|
count = StudentWorkProject.all.count / 30 + 2
|
|
transaction do
|
|
for i in 1 ... count do i
|
|
StudentWorkProject.page(i).per(30).each do |sp|
|
|
if !sp.student_work_id.nil? && sp.student_work.nil?
|
|
sp.destroy
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def down
|
|
end
|
|
end
|