diff --git a/db/migrate/20140722024513_update_course_attachment.rb b/db/migrate/20140722024513_update_course_attachment.rb new file mode 100644 index 000000000..6b0372b5b --- /dev/null +++ b/db/migrate/20140722024513_update_course_attachment.rb @@ -0,0 +1,20 @@ +class UpdateCourseAttachment < ActiveRecord::Migration + # 更新课程资源类型 + def up + Attachment.all.each do |attachment| + if attachment.container_type == 'Course' + if attachment.attachtype == 1 + attachment.attachtype = 4 + elsif attachment.attachtype == 2 + attachment.attachtype = 5 + elsif attachment.attachtype == 3 + attachment.attachtype = 6 + end + attachment.save + end + end + end + + def down + end +end