课程各数据迁移时不再做验证,以兼容老数据
This commit is contained in:
parent
bb86ef4612
commit
993ac23a36
|
@ -11,7 +11,7 @@ class AddBoardsTypeToBoards < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
board.course_id = project.course_extra.id
|
||||
board.project_id = -1
|
||||
board.save
|
||||
board.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
|
|||
course.attachmenttype = 2
|
||||
#course.lft = project.lft
|
||||
#course.rgt = project.rgt
|
||||
course.save
|
||||
course.save(:validate => false)
|
||||
|
||||
# 更新状态表
|
||||
projectstatus = ProjectStatus.find_by_project_id(project.id)
|
||||
|
@ -25,7 +25,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
|
|||
courseStatus.watchers_count = projectstatus.watchers_count
|
||||
courseStatus.grade = projectstatus.grade
|
||||
courseStatus.course_ac_para = projectstatus.course_ac_para
|
||||
courseStatus.save
|
||||
courseStatus.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,12 +6,13 @@ class AddCourseidToEnabledModules < ActiveRecord::Migration
|
|||
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all("course_id = project_id")
|
||||
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all(project_id: -1)
|
||||
|
||||
|
||||
EnabledModule.all.each do |enablemodule|
|
||||
project = Project.find_by_id(enablemodule.project_id)
|
||||
if project && project.project_type == 1
|
||||
enablemodule.course_id = project.course_extra.id
|
||||
enablemodule.project_id = -1
|
||||
enablemodule.save
|
||||
enablemodule.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ class AddCourseidToToMembers < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
member.course_id = project.course_extra.id
|
||||
member.project_id = -1
|
||||
member.save
|
||||
member.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration
|
|||
project = Project.find_by_id(work.course_id)
|
||||
if project && project.project_type == 1
|
||||
work.course_id = project.course_extra.id
|
||||
work.save
|
||||
work.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class CreateCourseInfos < ActiveRecord::Migration
|
|||
courseinfo = CourseInfos.new
|
||||
courseinfo.course_id = course.id
|
||||
courseinfo.user_id = projinfo.user_id
|
||||
courseinfo.save
|
||||
courseinfo.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class MigrateCourseTags < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
tagging.taggable_type= 'Course'
|
||||
tagging.taggable_id = project.course_extra.id
|
||||
tagging.save
|
||||
tagging.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class MigrateCourseJournals < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
journal.jour_type = 'Course'
|
||||
journal.jour_id = project.course_extra.id
|
||||
journal.save
|
||||
journal.save(:validate => false)
|
||||
end
|
||||
# 将自动设置的更新日期还原
|
||||
sql = ActiveRecord::Base.connection()
|
||||
|
|
|
@ -47,7 +47,7 @@ class AddCourseRoles < ActiveRecord::Migration
|
|||
role.permissions.append(:view_course_files )
|
||||
role.permissions.append(:view_course_journals_for_messages )
|
||||
role.permissions.append(:view_course_messages )
|
||||
role.save
|
||||
role.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class AddCourseidToNews < ActiveRecord::Migration
|
|||
if project && project.project_type == 1
|
||||
news.course_id = project.course_extra.id
|
||||
news.project_id = -1
|
||||
news.save
|
||||
news.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class RemoveDataToHomeworkAttach < ActiveRecord::Migration
|
|||
homework.description = biding.description
|
||||
homework.user_id = biding.user_id
|
||||
homework.state = 0
|
||||
homework.save
|
||||
homework.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class MigrateCourseStudents < ActiveRecord::Migration
|
|||
project = Project.find_by_id(student.course_id)
|
||||
if project && project.course_extra
|
||||
student.course_id = project.course_extra.id
|
||||
student.save
|
||||
student.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class MigrateCourseFileType < ActiveRecord::Migration
|
|||
Attachment.all.each do |attach|
|
||||
if attach.container_type == "Course" && attach.attachtype == 1
|
||||
attach.attachtype = 4
|
||||
attach.save
|
||||
attach.save(:validate => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class ModifyStudentRoles < ActiveRecord::Migration
|
|||
role = Role.find_by_name('学生')
|
||||
if role
|
||||
role.permissions.append(:add_messages)
|
||||
role.save
|
||||
role.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
64
db/schema.rb
64
db/schema.rb
|
@ -175,58 +175,6 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
|
|||
|
||||
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
|
||||
|
||||
create_table "code_review_assignments", :force => true do |t|
|
||||
t.integer "issue_id"
|
||||
t.integer "change_id"
|
||||
t.integer "attachment_id"
|
||||
t.string "file_path"
|
||||
t.string "rev"
|
||||
t.string "rev_to"
|
||||
t.string "action_type"
|
||||
t.integer "changeset_id"
|
||||
end
|
||||
|
||||
create_table "code_review_project_settings", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "tracker_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "updated_by"
|
||||
t.boolean "hide_code_review_tab", :default => false
|
||||
t.integer "auto_relation", :default => 1
|
||||
t.integer "assignment_tracker_id"
|
||||
t.text "auto_assign"
|
||||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.boolean "tracker_in_review_dialog", :default => false
|
||||
end
|
||||
|
||||
create_table "code_review_user_settings", :force => true do |t|
|
||||
t.integer "user_id", :default => 0, :null => false
|
||||
t.integer "mail_notification", :default => 0, :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "code_reviews", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "change_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "line"
|
||||
t.integer "updated_by_id"
|
||||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.integer "status_changed_from"
|
||||
t.integer "status_changed_to"
|
||||
t.integer "issue_id"
|
||||
t.string "action_type"
|
||||
t.string "file_path"
|
||||
t.string "rev"
|
||||
t.string "rev_to"
|
||||
t.integer "attachment_id"
|
||||
t.integer "file_count", :default => 0, :null => false
|
||||
t.boolean "diff_all"
|
||||
end
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
t.string "commented_type", :limit => 30, :default => "", :null => false
|
||||
t.integer "commented_id", :default => 0, :null => false
|
||||
|
@ -1041,13 +989,11 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
|
|||
end
|
||||
|
||||
create_table "user_scores", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "collaboration"
|
||||
t.integer "influence"
|
||||
t.integer "skill"
|
||||
t.integer "active"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
t.integer "collaboration"
|
||||
t.integer "influence"
|
||||
t.integer "skill"
|
||||
t.integer "activity"
|
||||
end
|
||||
|
||||
create_table "user_statuses", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue