Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
9e25d8f10c
@ -0,0 +1,11 @@
|
||||
class MigrateCourseSchoolId < ActiveRecord::Migration
|
||||
def up
|
||||
courses = Course.includes(teacher: :user_extensions).where("courses.school_id != user_extensions.school_id or courses.school_id is null")
|
||||
courses.each do |course|
|
||||
course.update_column('school_id', course.teacher.try(:user_extensions).try(:school_id))
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in new issue