diff --git a/db/migrate/20200102030945_modify_course_group_for_courses.rb b/db/migrate/20200102030946_modify_course_group_for_courses.rb similarity index 86% rename from db/migrate/20200102030945_modify_course_group_for_courses.rb rename to db/migrate/20200102030946_modify_course_group_for_courses.rb index 6e71af35b..e36bc9e0b 100644 --- a/db/migrate/20200102030945_modify_course_group_for_courses.rb +++ b/db/migrate/20200102030946_modify_course_group_for_courses.rb @@ -4,7 +4,9 @@ class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2] ActiveRecord::Base.transaction do groups.each do |g| CourseGroup.where(name: g.name).where.not(id: g.id).each do |cg| - cg.course_members.update_all(course_group_id: g.id) + cg.course_members.each do |cm| + cm.update_attributes!(course_group_id: g.id) + end cg.exercise_group_settings.update_all(course_group_id: g.id) cg.attachment_group_settings.update_all(course_group_id: g.id) cg.homework_group_reviews.update_all(course_group_id: g.id)