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.
trustieforge/db/migrate/20140722024513_update_cours...

21 lines
490 B

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