parent
7305b20ab0
commit
3369183fb7
@ -0,0 +1,19 @@
|
|||||||
|
class UpdateCourseTerm < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = Course.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
Course.page(i).per(30).each do |course|
|
||||||
|
if course.end_time.nil? && course.end_term.nil?
|
||||||
|
course.end_time = course.time
|
||||||
|
course.end_term = course.term
|
||||||
|
course.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue