class StoredCourseProcedure < ActiveRecord::Migration def self.up # 需要完成的数据导入: # project中所有的课程导入至course # Project_status导入至course_status # Project.all.each do |project| if project.project_type == 1 course = Course.find_by_extra(project.identifier) if course course.name = project.name course.description = project.description course.status = project.status course.attachmenttype = 2 course.lft = project.lft course.rgt = project.rgt course.save # 更新状态表 projectstatus = ProjectStatus.find_by_project_id(project.id) if projectstatus courseStatus = CourseStatus.new courseStatus.course_id = course.id courseStatus.changesets_count = projectstatus.changesets_count courseStatus.watchers_count = projectstatus.watchers_count courseStatus.grade = projectstatus.grade courseStatus.course_ac_para = projectstatus.course_ac_para courseStatus.save end end end end end def self.down end end