diff --git a/db/migrate/20140603033359_add_boards_type_to_boards.rb b/db/migrate/20140603033359_add_boards_type_to_boards.rb index fcef8b11..85b3723f 100644 --- a/db/migrate/20140603033359_add_boards_type_to_boards.rb +++ b/db/migrate/20140603033359_add_boards_type_to_boards.rb @@ -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 diff --git a/db/migrate/20140603042015_stored_course_procedure.rb b/db/migrate/20140603042015_stored_course_procedure.rb index 5dd6bc38..2f5faf5c 100644 --- a/db/migrate/20140603042015_stored_course_procedure.rb +++ b/db/migrate/20140603042015_stored_course_procedure.rb @@ -8,13 +8,19 @@ class StoredCourseProcedure < ActiveRecord::Migration 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 + sql = "update courses set name='" + project.name.to_s + "',description='" + sql += project.description.to_s + "',status=" + project.status.to_s + sql += ",attachmenttype=2 where id=" +course.id.to_s + execute(sql) + + # 以下方式保存,描述等经常不能成功 + #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 + #course.save(:validate => false) # 更新状态表 projectstatus = ProjectStatus.find_by_project_id(project.id) @@ -25,7 +31,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 diff --git a/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb b/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb index be4fe7e6..61484481 100644 --- a/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb +++ b/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb @@ -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 diff --git a/db/migrate/20140604011630_add_courseid_to_to_members.rb b/db/migrate/20140604011630_add_courseid_to_to_members.rb index 583e3a2d..1fb547d6 100644 --- a/db/migrate/20140604011630_add_courseid_to_to_members.rb +++ b/db/migrate/20140604011630_add_courseid_to_to_members.rb @@ -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 diff --git a/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb b/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb index 613f141c..e9cf6ee1 100644 --- a/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb +++ b/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb @@ -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 diff --git a/db/migrate/20140605025300_create_course_infos.rb b/db/migrate/20140605025300_create_course_infos.rb index b1947f3d..daf9f953 100644 --- a/db/migrate/20140605025300_create_course_infos.rb +++ b/db/migrate/20140605025300_create_course_infos.rb @@ -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 diff --git a/db/migrate/20140605025303_migrate_course_tags.rb b/db/migrate/20140605025303_migrate_course_tags.rb index 6e95839e..83926ae8 100644 --- a/db/migrate/20140605025303_migrate_course_tags.rb +++ b/db/migrate/20140605025303_migrate_course_tags.rb @@ -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 diff --git a/db/migrate/20140606027403_migrate_course_journals.rb b/db/migrate/20140606027403_migrate_course_journals.rb index 4a13ef38..b601483a 100644 --- a/db/migrate/20140606027403_migrate_course_journals.rb +++ b/db/migrate/20140606027403_migrate_course_journals.rb @@ -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() diff --git a/db/migrate/20140606028512_add_course_roles.rb b/db/migrate/20140606028512_add_course_roles.rb index 7b84b92a..3435dd25 100644 --- a/db/migrate/20140606028512_add_course_roles.rb +++ b/db/migrate/20140606028512_add_course_roles.rb @@ -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 diff --git a/db/migrate/20140611161801_add_courseid_to_news.rb b/db/migrate/20140611161801_add_courseid_to_news.rb index 5ca62a6a..b1a34938 100644 --- a/db/migrate/20140611161801_add_courseid_to_news.rb +++ b/db/migrate/20140611161801_add_courseid_to_news.rb @@ -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 diff --git a/db/migrate/20140618020535_remove_data_to_homework_attach.rb b/db/migrate/20140618020535_remove_data_to_homework_attach.rb index 16a1b491..9067e406 100644 --- a/db/migrate/20140618020535_remove_data_to_homework_attach.rb +++ b/db/migrate/20140618020535_remove_data_to_homework_attach.rb @@ -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 diff --git a/db/migrate/20140618105213_migrate_course_students.rb b/db/migrate/20140618105213_migrate_course_students.rb index ef037682..9eb43e4b 100644 --- a/db/migrate/20140618105213_migrate_course_students.rb +++ b/db/migrate/20140618105213_migrate_course_students.rb @@ -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 diff --git a/db/migrate/20140618155324_migrate_course_file_type.rb b/db/migrate/20140618155324_migrate_course_file_type.rb index 6cbf3b87..a91b1461 100644 --- a/db/migrate/20140618155324_migrate_course_file_type.rb +++ b/db/migrate/20140618155324_migrate_course_file_type.rb @@ -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 diff --git a/db/migrate/20140626012511_modify_student_roles.rb b/db/migrate/20140626012511_modify_student_roles.rb index 1db0a734..18274871 100644 --- a/db/migrate/20140626012511_modify_student_roles.rb +++ b/db/migrate/20140626012511_modify_student_roles.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index cc3d68cb..9962892d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1041,13 +1041,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|