You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
445 B
11 lines
445 B
5 years ago
|
class AddAnnouncementToCourseModules < ActiveRecord::Migration[5.2]
|
||
|
def change
|
||
|
Course.all.each do |course|
|
||
|
unless course.course_modules.exists?(module_type: "announcement")
|
||
|
course.course_modules.where.not(module_type: "activity").update_all("position = position + 1")
|
||
|
course.course_modules << CourseModule.new(module_type: "announcement", hidden: 1, module_name: "公告栏", position: 2)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|