From 2a9d6eb01230a508cba38859a871cc6a85fc47c8 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 18 Jun 2014 16:11:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=8E=9F=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20140618155324_migrate_course_file_type.rb | 12 ++++++++++++ db/schema.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20140618155324_migrate_course_file_type.rb diff --git a/db/migrate/20140618155324_migrate_course_file_type.rb b/db/migrate/20140618155324_migrate_course_file_type.rb new file mode 100644 index 000000000..6cbf3b878 --- /dev/null +++ b/db/migrate/20140618155324_migrate_course_file_type.rb @@ -0,0 +1,12 @@ +class MigrateCourseFileType < ActiveRecord::Migration + def change + # 迁移原课程资源文件类型 + Attachment.all.each do |attach| + if attach.container_type == "Course" && attach.attachtype == 1 + attach.attachtype = 4 + attach.save + end + end + end + +end diff --git a/db/schema.rb b/db/schema.rb index 18a3fb841..8c6ed01fe 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140618105214) do +ActiveRecord::Schema.define(:version => 20140618155324) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false