From 840a7b337b169d493cc45877fd2b0c328618d309 Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 22 Jul 2014 10:50:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=86=85=E5=AE=B9=E7=B1=BB=E5=9E=8B=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20140722024513_update_course_attachment.rb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 db/migrate/20140722024513_update_course_attachment.rb 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