diff --git a/db/migrate/20190309085449_migrate_course_members.rb b/db/migrate/20190309085449_migrate_course_members.rb index 1e4e8c819..a6d049dd7 100644 --- a/db/migrate/20190309085449_migrate_course_members.rb +++ b/db/migrate/20190309085449_migrate_course_members.rb @@ -4,7 +4,7 @@ class MigrateCourseMembers < ActiveRecord::Migration[5.2] Course.find_each do |course| position = 1 - course.course_groups.reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").find_each do |group| + course.course_groups.reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each do |group| group.update_attribute(:position, position) position += 1 end diff --git a/db/migrate/20190720063520_migrate_course_groups_position.rb b/db/migrate/20190720063520_migrate_course_groups_position.rb deleted file mode 100644 index dbc38a9b5..000000000 --- a/db/migrate/20190720063520_migrate_course_groups_position.rb +++ /dev/null @@ -1,11 +0,0 @@ -class MigrateCourseGroupsPosition < ActiveRecord::Migration[5.2] - def change - Course.find_each do |course| - position = 1 - course.course_groups.unscoped.reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each do |group| - group.update_attribute(:position, position) - position += 1 - end - end - end -end