分班的position迁移

dev_tj
cxt 5 years ago
parent 52ab6eb9e7
commit 34c5c550fa

@ -6,7 +6,7 @@ class MigrateCoureGroupPosition < ActiveRecord::Migration[5.2]
courses = Course.where(id: course_ids)
courses.each do |course|
CourseGroup.where(coures_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index|
CourseGroup.where(course_id: course.id).reorder("position ASC, CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each_with_index do |group, index|
group.update!(position: index+1)
end
end

Loading…
Cancel
Save