From 4f5acb6f7936882815f3b014bb70d57c009b701a Mon Sep 17 00:00:00 2001
From: Jasder <2053003901@@qq.com>
Date: Tue, 7 Jan 2020 19:30:06 +0800
Subject: [PATCH 1/7] FIX delete migration file
---
...20180920063955_create_graduation_topics.rb | 26 ----
.../20181024015607_add_column_to_poll.rb | 6 -
...20181105031300_add_repo_name_to_shixuns.rb | 5 -
...181105061745_add_repo_name_to_myshixuns.rb | 5 -
.../20181115071148_create_relationships.rb | 13 --
.../20181118075620_sync_gitlab_admin.rb | 6 -
...1207064509_add_cloud_url_to_attachments.rb | 5 -
...181213024859_add_averge_star_to_shixuns.rb | 5 -
...81213025239_sync_averger_star_to_shixun.rb | 12 --
.../20181228095820_create_shixun_infos.rb | 12 --
.../20181228115324_add_index_to_users.rb | 5 -
...9_modify_status_and_visits_for_subjects.rb | 6 -
...0109005614_add_opening_time_for_shixuns.rb | 5 -
...9013210_modify_opening_time_for_shixuns.rb | 5 -
...956_add_averge_star_default_for_shixuns.rb | 5 -
db/migrate/20190120063702_sync_reponame.rb | 16 ---
...190220014052_add_shixuns_count_to_stage.rb | 5 -
...0220061013_add_shixuns_count_to_subject.rb | 5 -
...220074947_sync_cache_count_for_subjects.rb | 8 --
...0190221003048_add_users_count_to_shixun.rb | 5 -
...90221003137_sync_users_count_for_shixun.rb | 7 --
...190228030508_delete_none_myshixun_games.rb | 6 -
...20190304082236_create_challenge_answers.rb | 13 --
.../20190304082811_create_course_members.rb | 19 ---
...0305015556_modify_answer_open_for_games.rb | 5 -
...102_add_checkout_answer_score_for_games.rb | 5 -
...0703_add_course_members_count_to_course.rb | 9 --
.../20190306023331_add_score_for_test_sets.rb | 6 -
...6064421_add_answer_for_challenge_answer.rb | 10 --
.../20190307063217_add_pod_life_to_shixuns.rb | 5 -
.../20190309085449_migrate_course_members.rb | 38 ------
.../20190309091056_add_course_member_id.rb | 21 ----
...64138_add_course_groups_count_to_course.rb | 9 --
...311080729_add_position_to_course_groups.rb | 5 -
...1090818_create_course_second_categories.rb | 12 --
...12024018_migrate_course_second_category.rb | 19 ---
...dd_course_second_category_to_attachment.rb | 6 -
...321081720_add_praises_count_to_messages.rb | 11 --
...raise_or_tread_default_in_praise_treads.rb | 5 -
.../20190322065716_create_message_details.rb | 11 --
..._content_of_messages_to_message_details.rb | 10 --
...0322091313_remove_content_from_messages.rb | 5 -
...20190323005303_modify_graduation_topics.rb | 8 --
...022227_add_is_public_to_graduation_task.rb | 8 --
..._change_digest_to_string_in_attachments.rb | 5 -
...900_add_hidden_for_journal_for_messages.rb | 5 -
...0190326095920_add_is_hidden_to_messages.rb | 6 -
...20190327063241_course_group_count_cache.rb | 5 -
...0190329091942_add_index_to_shixun_infos.rb | 5 -
...change_quotes_to_integer_in_attachments.rb | 6 -
...4623_add_index_to_attachments_is_public.rb | 5 -
...18_add_invalid_to_graduation_work_score.rb | 5 -
...on_migration.acts_as_taggable_on_engine.rb | 40 -------
...ique_indices.acts_as_taggable_on_engine.rb | 26 ----
...ache_to_tags.acts_as_taggable_on_engine.rb | 20 ----
...ggable_index.acts_as_taggable_on_engine.rb | 15 ---
...or_tag_names.acts_as_taggable_on_engine.rb | 15 ---
..._on_taggings.acts_as_taggable_on_engine.rb | 23 ----
.../20190403022053_create_gtask_banks.rb | 19 ---
...praises_count_for_jouranls_for_messages.rb | 13 --
.../20190403065609_create_gtopic_banks.rb | 23 ----
...is_ordered_to_exercise_standard_answers.rb | 6 -
...190410033511_change_column_in_homeworks.rb | 12 --
...ange_is_ordered_from_answer_to_question.rb | 6 -
...0410081736_migrate_homework_attachments.rb | 5 -
...5_add_cloud_url_to_attachment_histories.rb | 5 -
...15090426_change_homework_common_columns.rb | 13 --
...190422032141_migrate_homework_late_time.rb | 21 ----
...for_messages_count_for_hm_and_gt_and_gw.rb | 18 ---
...4128_migrate_homework_anonymous_comment.rb | 7 --
..._add_is_invalid_to_student_works_scores.rb | 25 ----
...27010940_change_exercise_score_to_float.rb | 29 -----
...427045904_update_exercise_default_value.rb | 7 --
...igest_to_string_in_attachment_histories.rb | 5 -
...0190429015510_add_default_for_exercises.rb | 7 --
...080104_add_quotes_for_graduation_topics.rb | 5 -
.../20190430090659_add_default_for_polls.rb | 5 -
db/migrate/20190505031946_sync_users_index.rb | 8 --
.../20190505072404_remove_index_from_users.rb | 5 -
db/migrate/20190505093440_init_use_index.rb | 9 --
...d_professional_certification_to_courses.rb | 6 -
...8090916_migrate_new_student_work_status.rb | 6 -
...0190511020736_add_is_public_to_messages.rb | 5 -
.../20190514023907_add_column_to_zip_packs.rb | 10 --
...083047_change_question_random_exercises.rb | 11 --
...5014734_change_poll_show_result_boolean.rb | 10 --
...313_add_test_set_average_for_challenges.rb | 5 -
.../20190517085407_create_edu_settings.rb | 10 --
...7092730_add_description_to_edu_settings.rb | 14 ---
...085626_add_index_to_verificatiojn_codes.rb | 6 -
.../20190522091226_alter_educoder_indexs.rb | 70 -----------
...524020819_change_exercise_question_type.rb | 10 --
.../20190528024055_migrate_base_on_project.rb | 5 -
...0603024856_migrate_course_late_settings.rb | 9 --
...1948_migrate_student_works_scores_score.rb | 5 -
...620_change_question_random_default_true.rb | 12 --
...190613022158_add_exec_time_to_challenge.rb | 9 --
..._change_default_data_for_name_in_borads.rb | 10 --
...055012_add_uniq_index_to_course_modules.rb | 43 -------
...19093200_add_profile_completed_to_users.rb | 5 -
...9_add_graduation_topics_count_to_course.rb | 9 --
...20190619123328_sync_countcha_for_course.rb | 11 --
...0010439_add_uniq_index_to_course_member.rb | 10 --
.../20190620015912_modify_colla_index.rb | 51 --------
...ework_bank_id_index_to_homework_commons.rb | 5 -
...d_bank_id_for_graduation_task_and_topic.rb | 6 -
...0190621010002_change_default_to_max_num.rb | 5 -
...21062948_migrate_course_module_activity.rb | 5 -
...83604_add_descendants_count_to_messages.rb | 5 -
.../20190621105144_sync_ivalid_users.rb | 34 ------
...22055449_modify_shixun_info_for_shixuns.rb | 15 ---
...005_remove_shixun_long_text_for_shixuns.rb | 7 --
...iq_index_to_homework_challenge_settings.rb | 10 --
...625012548_add_index_for_evaluate_record.rb | 6 -
...27012118_modify_quotes_for_gtopic_banks.rb | 6 -
...013243_add_calculation_time_to_homework.rb | 6 -
...611_add_old_exercise_tiankong_choice_id.rb | 23 ----
...703090511_add_index_for_shixun_services.rb | 9 --
...011739_add_praises_count_for_challenges.rb | 5 -
...204_modify_praises_count_for_challenges.rb | 9 --
...05022502_add_praises_count_for_discuess.rb | 5 -
...22737_modify_praises_count_for_discuess.rb | 9 --
.../20190705085829_add_sec_key_to_outputs.rb | 7 --
.../20190706010307_create_user_interests.rb | 8 --
...08062910_add_index_for_run_code_message.rb | 5 -
...62033_modify_challenge_id_for_discusses.rb | 11 --
...modify_md_attachment_url_for_md_cotents.rb | 35 ------
...6064225_add_max_mem_to_evaluate_records.rb | 5 -
.../20190720025309_add_ts_mem_for_outputs.rb | 5 -
.../20190720025341_add_ts_time_for_outputs.rb | 5 -
.../20190720121537_add_is_md_for_messages.rb | 5 -
...0190720122123_modify_is_md_for_messages.rb | 7 --
...0722062801_modify_answer_for_challenges.rb | 11 --
..._contents_is_null_for_challenge_answers.rb | 6 -
...0724013024_modify_final_score_for_games.rb | 15 ---
.../20190726082937_add_is_md_for_homeworks.rb | 12 --
.../20190726083814_migrate_course_is_md.rb | 14 ---
.../20190729080935_modify_login_for_users.rb | 9 --
...22_delete_error_myshixun_from_myshxiuns.rb | 11 --
...9122213_delete_myshixun_games_for_users.rb | 11 --
...190801075337_add_praises_count_to_memos.rb | 12 --
...01084533_add_praises_count_to_libraries.rb | 10 --
.../20190802105008_tranfer_tiding_data.rb | 5 -
.../20190805004505_sync_index_to_users.rb | 7 --
...5010562_modify_ke_contents_for_markdown.rb | 51 --------
...805014624_migrate_anonymous_tiding_type.rb | 6 -
...61306_add_exec_time_to_evaluate_records.rb | 7 --
...062209_second_mofidy_ke_contents_for_md.rb | 64 ----------
...063903_third_modify_ke_for_student_work.rb | 17 ---
db/migrate/20190808025851_create_videos.rb | 20 ----
.../20190809010636_create_video_applies.rb | 10 --
...20190813015633_add_new_column_to_course.rb | 8 --
...20190813074730_add_excellent_to_courses.rb | 5 -
...5064542_modify_class_period_for_courses.rb | 8 --
...190815085136_modify_path_for_challenges.rb | 5 -
.../20190819081514_add_filesize_to_videos.rb | 5 -
...0820021047_migrate_course_task_position.rb | 5 -
...820102040_change_exercise_1930_position.rb | 29 -----
.../20190821054352_create_open_users.rb | 14 ---
...migrate_course_shixun_homework_position.rb | 11 --
...20190822022306_add_exercise_user_update.rb | 39 ------
...0823015610_add_message_count_for_boards.rb | 9 --
...3_modify_course_introduction_for_boards.rb | 42 -------
...modify_contents_for_old_message_details.rb | 13 --
...823090957_rechange_exercise_1936_scores.rb | 19 ---
...0824032658_migrate_subject_shixun_count.rb | 9 --
...55814_modify_challnege_score_for_choose.rb | 10 --
...222_add_update_user_id_to_student_works.rb | 6 -
...dd_is_ordered_to_exercise_bank_question.rb | 5 -
...829025855_migrate_gtopic_bank_is_public.rb | 5 -
...829084147_migrate_course_group_position.rb | 11 --
...4803_add_announcement_to_course_modules.rb | 10 --
.../20190830082934_add_tag_to_libraries.rb | 5 -
...190831014325_migrate_poll_bank_question.rb | 6 -
...49_migrate_excellent_course_course_list.rb | 12 --
...raduation_work_id_to_group_assignations.rb | 7 --
...90903025159_add_temporary_to_graduation.rb | 6 -
...20190905070518_reorder_coo_img_position.rb | 9 --
...70821_change_public_model_default_value.rb | 20 ----
.../20190906062930_modify_is_test_for_user.rb | 5 -
.../20190906111746_gtopic_bank_is_public.rb | 5 -
...0907014649_add_vnc_evaluate_for_shixuns.rb | 5 -
...0190907021100_migrate_bank_reference_id.rb | 31 -----
.../20190907061918_migrate_bank_quotes.rb | 28 -----
...61930_create_shixun_secret_repositories.rb | 10 --
...0909072626_add_match_rule_for_test_sets.rb | 7 --
...90909080508_create_shixun_work_comments.rb | 13 --
...90909082555_migrate_shixun_work_comment.rb | 13 --
.../20190910061807_create_course_stages.rb | 13 --
...90910062710_create_course_stage_shixuns.rb | 12 --
.../20190910063345_migrate_course_stages.rb | 14 ---
...90911020749_migrate_shixun_student_work.rb | 18 ---
...019_add_code_edit_permission_for_shixun.rb | 6 -
...0190911080150_change_ec_course_supports.rb | 11 --
.../20190911103449_migrate_grade_index.rb | 7 --
..._migrate_graduation_task_comment_status.rb | 5 -
...0920073337_migrate_user_extension_index.rb | 6 -
...921010411_add_course_member_to_subjects.rb | 6 -
...90921015840_create_subject_appointments.rb | 10 --
..._add_update_user_id_to_graduation_works.rb | 6 -
.../20190926024819_add_library_tag_data.rb | 9 --
...27091948_change_user_p02389416_exercise.rb | 33 -----
.../20190930020534_migrate_forum_name.rb | 9 --
.../20190930032241_create_diff_records.rb | 11 --
...90930032255_create_diff_record_contents.rb | 9 --
...20191007010405_resort_portal_image_data.rb | 7 --
.../20191010011844_create_laboratories.rb | 12 --
.../20191010012226_create_laboratory_users.rb | 8 --
...191010063403_create_laboratory_settings.rb | 9 --
...0191011025619_init_edu_coder_laboratory.rb | 22 ----
...0441_add_commit_method_to_exercise_user.rb | 5 -
.../20191014061301_migrate_course_atta.rb | 7 --
...15013924_add_new_column_to_competitions.rb | 6 -
...015723_create_competition_mode_settings.rb | 11 --
...6070842_add_description_to_competitions.rb | 6 -
...5036_add_laboratory_id_to_portal_images.rb | 8 --
.../20191017024643_add_extra_to_open_users.rb | 5 -
...3840_add_competition_id_to_mode_setting.rb | 7 --
...0191017092449_migrate_competition_score.rb | 29 -----
.../20191018015007_create_shixun_reviews.rb | 12 --
...0191018022821_create_competition_awards.rb | 12 --
...018030029_add_rate_to_competition_stage.rb | 5 -
.../20191019075105_create_module_settings.rb | 12 --
...9082903_change_column_competition_stage.rb | 5 -
...141738_migrate_exercise_challenge_score.rb | 25 ----
...021150220_migrate_exercise_answer_score.rb | 110 -----------------
...4016_migrate_2734_exercise_answer_score.rb | 113 ------------------
.../20191022003750_create_weapp_settings.rb | 12 --
...0127_migrate_competition_score_stage_id.rb | 7 --
...075223_migrate_competition_mode_default.rb | 6 -
...2100044_add_awards_count_to_competition.rb | 5 -
...3074837_migrate_competition_module_type.rb | 28 -----
...91024055404_migrate_com_module_resource.rb | 26 ----
...75134_migrate_competition_module_manual.rb | 5 -
...3706_migrate_competition_module_content.rb | 17 ---
...4090740_migrate_competition_chart_rules.rb | 5 -
...191024105504_create_competition_schools.rb | 11 --
...1025012950_add_column_to_stage_sections.rb | 8 --
.../20191026110116_migrate_chart_rule.rb | 12 --
...20191028025241_re_counter_course_groups.rb | 7 --
...91029003245_create_competition_managers.rb | 10 --
...9011040_add_statistics_to_course_module.rb | 7 --
.../20191029065244_init_trustie_config.rb | 8 --
...344_add_total_score_to_homework_commons.rb | 5 -
...nit_competition_certificate_module_data.rb | 10 --
...0191030013802_create_competition_prizes.rb | 13 --
...30055341_create_competition_prize_users.rb | 20 ----
...91030062150_create_exercise_user_scores.rb | 13 --
.../20191104033349_create_game_answers.rb | 13 --
...191104055038_add_index_for_game_answers.rb | 5 -
...191104063136_add_team_title_to_subjects.rb | 5 -
...191104080912_add_email_notify_to_course.rb | 5 -
...91104132649_migrate_2796_exercise_score.rb | 60 ----------
...0191105093740_create_trustie_hackathons.rb | 10 --
.../20191105093919_create_trustie_hacks.rb | 11 --
.../20191105094146_create_hack_users.rb | 9 --
...106015717_create_partner_manager_groups.rb | 13 --
.../20191106020241_create_partner_managers.rb | 11 --
...106020505_transfer_partner_manager_data.rb | 14 ---
...1106021452_remove_partner_id_from_users.rb | 5 -
..._trustie_hackathon_id_for_trustie_hacks.rb | 6 -
...91106055638_migrate_2808_exercise_score.rb | 111 -----------------
...106061342_add_uniq_index_for_hack_users.rb | 5 -
...0191106070243_create_laboratory_shixuns.rb | 13 --
...20191106094429_add_position_for_informs.rb | 17 ---
...191107023418_create_laboratory_subjects.rb | 13 --
...1107062552_add_email_notify_to_messages.rb | 5 -
...93428_add_column_to_exercise_user_score.rb | 6 -
...0703_modify_descriotion_limit_for_hacks.rb | 6 -
db/migrate/20191111082252_create_hacks.rb | 20 ----
.../20191111083528_create_hack_codes.rb | 11 --
db/migrate/20191111100954_create_hack_sets.rb | 13 --
.../20191111101536_create_hack_user_codes.rb | 18 ---
...12010611_create_hack_user_lastest_codes.rb | 12 --
.../20191112012007_create_hack_user_debugs.rb | 14 ---
.../20191112023111_add_defualt_for_hacks.rb | 7 --
...20191112100418_migrate_gcc_project_team.rb | 25 ----
.../20191112100820_add_score_for_hacks.rb | 5 -
...013258_gcc_course_competition_rank_data.rb | 9 --
...tus_end_time_for_hack_user_lastest_code.rb | 27 -----
...1114073028_add_sticky_to_course_members.rb | 6 -
...1115011229_add_laboratory_id_to_courses.rb | 5 -
...12535_add_laboratory_id_to_competitions.rb | 5 -
...191115053209_add_laboratory_id_to_users.rb | 5 -
...191115060527_add_copy_from_for_subjects.rb | 5 -
...15070508_add_laboratory_id_to_libraries.rb | 5 -
...20191115070841_transfer_laboratory_data.rb | 7 --
...191115121529_add_laborary_id_for_shixun.rb | 5 -
...user_lastest_code_id_for_hack_user_code.rb | 7 --
..._add_sync_course_to_laboratory_settings.rb | 5 -
...e_pass_time_for_hack_user_lastest_codes.rb | 6 -
...0191120080224_migrate_eff_score_default.rb | 5 -
...1120123353_add_code_forhack_user_debugs.rb | 5 -
..._modify_execute_time_for_hack_user_code.rb | 6 -
...1_add_sync_shixun_subject_to_laboratory.rb | 6 -
...32557_add_uniq_index_to_exercise_answer.rb | 17 ---
...1203040140_add_uniq_index_to_poll_votes.rb | 16 ---
...203122643_add_index_to_exercise_answers.rb | 5 -
...1203124903_add_index_to_exercise_choice.rb | 16 ---
...20191203124938_add_index_to_poll_answer.rb | 15 ---
300 files changed, 3712 deletions(-)
delete mode 100644 db/migrate/20180920063955_create_graduation_topics.rb
delete mode 100644 db/migrate/20181024015607_add_column_to_poll.rb
delete mode 100644 db/migrate/20181105031300_add_repo_name_to_shixuns.rb
delete mode 100644 db/migrate/20181105061745_add_repo_name_to_myshixuns.rb
delete mode 100644 db/migrate/20181115071148_create_relationships.rb
delete mode 100644 db/migrate/20181118075620_sync_gitlab_admin.rb
delete mode 100644 db/migrate/20181207064509_add_cloud_url_to_attachments.rb
delete mode 100644 db/migrate/20181213024859_add_averge_star_to_shixuns.rb
delete mode 100644 db/migrate/20181213025239_sync_averger_star_to_shixun.rb
delete mode 100644 db/migrate/20181228095820_create_shixun_infos.rb
delete mode 100644 db/migrate/20181228115324_add_index_to_users.rb
delete mode 100644 db/migrate/20190108074759_modify_status_and_visits_for_subjects.rb
delete mode 100644 db/migrate/20190109005614_add_opening_time_for_shixuns.rb
delete mode 100644 db/migrate/20190109013210_modify_opening_time_for_shixuns.rb
delete mode 100644 db/migrate/20190111063956_add_averge_star_default_for_shixuns.rb
delete mode 100644 db/migrate/20190120063702_sync_reponame.rb
delete mode 100644 db/migrate/20190220014052_add_shixuns_count_to_stage.rb
delete mode 100644 db/migrate/20190220061013_add_shixuns_count_to_subject.rb
delete mode 100644 db/migrate/20190220074947_sync_cache_count_for_subjects.rb
delete mode 100644 db/migrate/20190221003048_add_users_count_to_shixun.rb
delete mode 100644 db/migrate/20190221003137_sync_users_count_for_shixun.rb
delete mode 100644 db/migrate/20190228030508_delete_none_myshixun_games.rb
delete mode 100644 db/migrate/20190304082236_create_challenge_answers.rb
delete mode 100644 db/migrate/20190304082811_create_course_members.rb
delete mode 100644 db/migrate/20190305015556_modify_answer_open_for_games.rb
delete mode 100644 db/migrate/20190305074102_add_checkout_answer_score_for_games.rb
delete mode 100644 db/migrate/20190305080703_add_course_members_count_to_course.rb
delete mode 100644 db/migrate/20190306023331_add_score_for_test_sets.rb
delete mode 100644 db/migrate/20190306064421_add_answer_for_challenge_answer.rb
delete mode 100644 db/migrate/20190307063217_add_pod_life_to_shixuns.rb
delete mode 100644 db/migrate/20190309085449_migrate_course_members.rb
delete mode 100644 db/migrate/20190309091056_add_course_member_id.rb
delete mode 100644 db/migrate/20190311064138_add_course_groups_count_to_course.rb
delete mode 100644 db/migrate/20190311080729_add_position_to_course_groups.rb
delete mode 100644 db/migrate/20190311090818_create_course_second_categories.rb
delete mode 100644 db/migrate/20190312024018_migrate_course_second_category.rb
delete mode 100644 db/migrate/20190312032623_add_course_second_category_to_attachment.rb
delete mode 100644 db/migrate/20190321081720_add_praises_count_to_messages.rb
delete mode 100644 db/migrate/20190321091429_change_praise_or_tread_default_in_praise_treads.rb
delete mode 100644 db/migrate/20190322065716_create_message_details.rb
delete mode 100644 db/migrate/20190322070515_move_content_of_messages_to_message_details.rb
delete mode 100644 db/migrate/20190322091313_remove_content_from_messages.rb
delete mode 100644 db/migrate/20190323005303_modify_graduation_topics.rb
delete mode 100644 db/migrate/20190325022227_add_is_public_to_graduation_task.rb
delete mode 100644 db/migrate/20190325023830_change_digest_to_string_in_attachments.rb
delete mode 100644 db/migrate/20190326015900_add_hidden_for_journal_for_messages.rb
delete mode 100644 db/migrate/20190326095920_add_is_hidden_to_messages.rb
delete mode 100644 db/migrate/20190327063241_course_group_count_cache.rb
delete mode 100644 db/migrate/20190329091942_add_index_to_shixun_infos.rb
delete mode 100644 db/migrate/20190401083919_change_quotes_to_integer_in_attachments.rb
delete mode 100644 db/migrate/20190401094623_add_index_to_attachments_is_public.rb
delete mode 100644 db/migrate/20190402015918_add_invalid_to_graduation_work_score.rb
delete mode 100644 db/migrate/20190402083252_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
delete mode 100644 db/migrate/20190402083253_add_missing_unique_indices.acts_as_taggable_on_engine.rb
delete mode 100644 db/migrate/20190402083254_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
delete mode 100644 db/migrate/20190402083255_add_missing_taggable_index.acts_as_taggable_on_engine.rb
delete mode 100644 db/migrate/20190402083256_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
delete mode 100644 db/migrate/20190402083257_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
delete mode 100644 db/migrate/20190403022053_create_gtask_banks.rb
delete mode 100644 db/migrate/20190403025525_add_praises_count_for_jouranls_for_messages.rb
delete mode 100644 db/migrate/20190403065609_create_gtopic_banks.rb
delete mode 100644 db/migrate/20190408060723_add_is_ordered_to_exercise_standard_answers.rb
delete mode 100644 db/migrate/20190410033511_change_column_in_homeworks.rb
delete mode 100644 db/migrate/20190410081421_change_is_ordered_from_answer_to_question.rb
delete mode 100644 db/migrate/20190410081736_migrate_homework_attachments.rb
delete mode 100644 db/migrate/20190413011125_add_cloud_url_to_attachment_histories.rb
delete mode 100644 db/migrate/20190415090426_change_homework_common_columns.rb
delete mode 100644 db/migrate/20190422032141_migrate_homework_late_time.rb
delete mode 100644 db/migrate/20190422083020_add_journals_for_messages_count_for_hm_and_gt_and_gw.rb
delete mode 100644 db/migrate/20190424014128_migrate_homework_anonymous_comment.rb
delete mode 100644 db/migrate/20190426010412_add_is_invalid_to_student_works_scores.rb
delete mode 100644 db/migrate/20190427010940_change_exercise_score_to_float.rb
delete mode 100644 db/migrate/20190427045904_update_exercise_default_value.rb
delete mode 100644 db/migrate/20190429012219_change_digest_to_string_in_attachment_histories.rb
delete mode 100644 db/migrate/20190429015510_add_default_for_exercises.rb
delete mode 100644 db/migrate/20190429080104_add_quotes_for_graduation_topics.rb
delete mode 100644 db/migrate/20190430090659_add_default_for_polls.rb
delete mode 100644 db/migrate/20190505031946_sync_users_index.rb
delete mode 100644 db/migrate/20190505072404_remove_index_from_users.rb
delete mode 100644 db/migrate/20190505093440_init_use_index.rb
delete mode 100644 db/migrate/20190505095131_add_authentication_and_professional_certification_to_courses.rb
delete mode 100644 db/migrate/20190508090916_migrate_new_student_work_status.rb
delete mode 100644 db/migrate/20190511020736_add_is_public_to_messages.rb
delete mode 100644 db/migrate/20190514023907_add_column_to_zip_packs.rb
delete mode 100644 db/migrate/20190514083047_change_question_random_exercises.rb
delete mode 100644 db/migrate/20190515014734_change_poll_show_result_boolean.rb
delete mode 100644 db/migrate/20190517080313_add_test_set_average_for_challenges.rb
delete mode 100644 db/migrate/20190517085407_create_edu_settings.rb
delete mode 100644 db/migrate/20190517092730_add_description_to_edu_settings.rb
delete mode 100644 db/migrate/20190518085626_add_index_to_verificatiojn_codes.rb
delete mode 100644 db/migrate/20190522091226_alter_educoder_indexs.rb
delete mode 100644 db/migrate/20190524020819_change_exercise_question_type.rb
delete mode 100644 db/migrate/20190528024055_migrate_base_on_project.rb
delete mode 100644 db/migrate/20190603024856_migrate_course_late_settings.rb
delete mode 100644 db/migrate/20190606061948_migrate_student_works_scores_score.rb
delete mode 100644 db/migrate/20190610013620_change_question_random_default_true.rb
delete mode 100644 db/migrate/20190613022158_add_exec_time_to_challenge.rb
delete mode 100644 db/migrate/20190617081105_change_default_data_for_name_in_borads.rb
delete mode 100644 db/migrate/20190619055012_add_uniq_index_to_course_modules.rb
delete mode 100644 db/migrate/20190619093200_add_profile_completed_to_users.rb
delete mode 100644 db/migrate/20190619120609_add_graduation_topics_count_to_course.rb
delete mode 100644 db/migrate/20190619123328_sync_countcha_for_course.rb
delete mode 100644 db/migrate/20190620010439_add_uniq_index_to_course_member.rb
delete mode 100644 db/migrate/20190620015912_modify_colla_index.rb
delete mode 100644 db/migrate/20190620021243_add_homework_bank_id_index_to_homework_commons.rb
delete mode 100644 db/migrate/20190620075503_add_bank_id_for_graduation_task_and_topic.rb
delete mode 100644 db/migrate/20190621010002_change_default_to_max_num.rb
delete mode 100644 db/migrate/20190621062948_migrate_course_module_activity.rb
delete mode 100644 db/migrate/20190621083604_add_descendants_count_to_messages.rb
delete mode 100644 db/migrate/20190621105144_sync_ivalid_users.rb
delete mode 100644 db/migrate/20190622055449_modify_shixun_info_for_shixuns.rb
delete mode 100644 db/migrate/20190622060005_remove_shixun_long_text_for_shixuns.rb
delete mode 100644 db/migrate/20190624085120_add_uniq_index_to_homework_challenge_settings.rb
delete mode 100644 db/migrate/20190625012548_add_index_for_evaluate_record.rb
delete mode 100644 db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb
delete mode 100644 db/migrate/20190701013243_add_calculation_time_to_homework.rb
delete mode 100644 db/migrate/20190703072611_add_old_exercise_tiankong_choice_id.rb
delete mode 100644 db/migrate/20190703090511_add_index_for_shixun_services.rb
delete mode 100644 db/migrate/20190705011739_add_praises_count_for_challenges.rb
delete mode 100644 db/migrate/20190705013204_modify_praises_count_for_challenges.rb
delete mode 100644 db/migrate/20190705022502_add_praises_count_for_discuess.rb
delete mode 100644 db/migrate/20190705022737_modify_praises_count_for_discuess.rb
delete mode 100644 db/migrate/20190705085829_add_sec_key_to_outputs.rb
delete mode 100644 db/migrate/20190706010307_create_user_interests.rb
delete mode 100644 db/migrate/20190708062910_add_index_for_run_code_message.rb
delete mode 100644 db/migrate/20190711062033_modify_challenge_id_for_discusses.rb
delete mode 100644 db/migrate/20190713022300_modify_md_attachment_url_for_md_cotents.rb
delete mode 100644 db/migrate/20190716064225_add_max_mem_to_evaluate_records.rb
delete mode 100644 db/migrate/20190720025309_add_ts_mem_for_outputs.rb
delete mode 100644 db/migrate/20190720025341_add_ts_time_for_outputs.rb
delete mode 100644 db/migrate/20190720121537_add_is_md_for_messages.rb
delete mode 100644 db/migrate/20190720122123_modify_is_md_for_messages.rb
delete mode 100644 db/migrate/20190722062801_modify_answer_for_challenges.rb
delete mode 100644 db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb
delete mode 100644 db/migrate/20190724013024_modify_final_score_for_games.rb
delete mode 100644 db/migrate/20190726082937_add_is_md_for_homeworks.rb
delete mode 100644 db/migrate/20190726083814_migrate_course_is_md.rb
delete mode 100644 db/migrate/20190729080935_modify_login_for_users.rb
delete mode 100644 db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb
delete mode 100644 db/migrate/20190729122213_delete_myshixun_games_for_users.rb
delete mode 100644 db/migrate/20190801075337_add_praises_count_to_memos.rb
delete mode 100644 db/migrate/20190801084533_add_praises_count_to_libraries.rb
delete mode 100644 db/migrate/20190802105008_tranfer_tiding_data.rb
delete mode 100644 db/migrate/20190805004505_sync_index_to_users.rb
delete mode 100644 db/migrate/20190805010562_modify_ke_contents_for_markdown.rb
delete mode 100644 db/migrate/20190805014624_migrate_anonymous_tiding_type.rb
delete mode 100644 db/migrate/20190805061306_add_exec_time_to_evaluate_records.rb
delete mode 100644 db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb
delete mode 100644 db/migrate/20190806063903_third_modify_ke_for_student_work.rb
delete mode 100644 db/migrate/20190808025851_create_videos.rb
delete mode 100644 db/migrate/20190809010636_create_video_applies.rb
delete mode 100644 db/migrate/20190813015633_add_new_column_to_course.rb
delete mode 100644 db/migrate/20190813074730_add_excellent_to_courses.rb
delete mode 100644 db/migrate/20190815064542_modify_class_period_for_courses.rb
delete mode 100644 db/migrate/20190815085136_modify_path_for_challenges.rb
delete mode 100644 db/migrate/20190819081514_add_filesize_to_videos.rb
delete mode 100644 db/migrate/20190820021047_migrate_course_task_position.rb
delete mode 100644 db/migrate/20190820102040_change_exercise_1930_position.rb
delete mode 100644 db/migrate/20190821054352_create_open_users.rb
delete mode 100644 db/migrate/20190821072722_migrate_course_shixun_homework_position.rb
delete mode 100644 db/migrate/20190822022306_add_exercise_user_update.rb
delete mode 100644 db/migrate/20190823015610_add_message_count_for_boards.rb
delete mode 100644 db/migrate/20190823024643_modify_course_introduction_for_boards.rb
delete mode 100644 db/migrate/20190823063747_modify_contents_for_old_message_details.rb
delete mode 100644 db/migrate/20190823090957_rechange_exercise_1936_scores.rb
delete mode 100644 db/migrate/20190824032658_migrate_subject_shixun_count.rb
delete mode 100644 db/migrate/20190827055814_modify_challnege_score_for_choose.rb
delete mode 100644 db/migrate/20190828011222_add_update_user_id_to_student_works.rb
delete mode 100644 db/migrate/20190828055710_add_is_ordered_to_exercise_bank_question.rb
delete mode 100644 db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb
delete mode 100644 db/migrate/20190829084147_migrate_course_group_position.rb
delete mode 100644 db/migrate/20190830064803_add_announcement_to_course_modules.rb
delete mode 100644 db/migrate/20190830082934_add_tag_to_libraries.rb
delete mode 100644 db/migrate/20190831014325_migrate_poll_bank_question.rb
delete mode 100644 db/migrate/20190902062449_migrate_excellent_course_course_list.rb
delete mode 100644 db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb
delete mode 100644 db/migrate/20190903025159_add_temporary_to_graduation.rb
delete mode 100644 db/migrate/20190905070518_reorder_coo_img_position.rb
delete mode 100644 db/migrate/20190905070821_change_public_model_default_value.rb
delete mode 100644 db/migrate/20190906062930_modify_is_test_for_user.rb
delete mode 100644 db/migrate/20190906111746_gtopic_bank_is_public.rb
delete mode 100644 db/migrate/20190907014649_add_vnc_evaluate_for_shixuns.rb
delete mode 100644 db/migrate/20190907021100_migrate_bank_reference_id.rb
delete mode 100644 db/migrate/20190907061918_migrate_bank_quotes.rb
delete mode 100644 db/migrate/20190909061930_create_shixun_secret_repositories.rb
delete mode 100644 db/migrate/20190909072626_add_match_rule_for_test_sets.rb
delete mode 100644 db/migrate/20190909080508_create_shixun_work_comments.rb
delete mode 100644 db/migrate/20190909082555_migrate_shixun_work_comment.rb
delete mode 100644 db/migrate/20190910061807_create_course_stages.rb
delete mode 100644 db/migrate/20190910062710_create_course_stage_shixuns.rb
delete mode 100644 db/migrate/20190910063345_migrate_course_stages.rb
delete mode 100644 db/migrate/20190911020749_migrate_shixun_student_work.rb
delete mode 100644 db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb
delete mode 100644 db/migrate/20190911080150_change_ec_course_supports.rb
delete mode 100644 db/migrate/20190911103449_migrate_grade_index.rb
delete mode 100644 db/migrate/20190917024120_migrate_graduation_task_comment_status.rb
delete mode 100644 db/migrate/20190920073337_migrate_user_extension_index.rb
delete mode 100644 db/migrate/20190921010411_add_course_member_to_subjects.rb
delete mode 100644 db/migrate/20190921015840_create_subject_appointments.rb
delete mode 100644 db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb
delete mode 100644 db/migrate/20190926024819_add_library_tag_data.rb
delete mode 100644 db/migrate/20190927091948_change_user_p02389416_exercise.rb
delete mode 100644 db/migrate/20190930020534_migrate_forum_name.rb
delete mode 100644 db/migrate/20190930032241_create_diff_records.rb
delete mode 100644 db/migrate/20190930032255_create_diff_record_contents.rb
delete mode 100644 db/migrate/20191007010405_resort_portal_image_data.rb
delete mode 100644 db/migrate/20191010011844_create_laboratories.rb
delete mode 100644 db/migrate/20191010012226_create_laboratory_users.rb
delete mode 100644 db/migrate/20191010063403_create_laboratory_settings.rb
delete mode 100644 db/migrate/20191011025619_init_edu_coder_laboratory.rb
delete mode 100644 db/migrate/20191011030441_add_commit_method_to_exercise_user.rb
delete mode 100644 db/migrate/20191014061301_migrate_course_atta.rb
delete mode 100644 db/migrate/20191015013924_add_new_column_to_competitions.rb
delete mode 100644 db/migrate/20191015015723_create_competition_mode_settings.rb
delete mode 100644 db/migrate/20191016070842_add_description_to_competitions.rb
delete mode 100644 db/migrate/20191016075036_add_laboratory_id_to_portal_images.rb
delete mode 100644 db/migrate/20191017024643_add_extra_to_open_users.rb
delete mode 100644 db/migrate/20191017063840_add_competition_id_to_mode_setting.rb
delete mode 100644 db/migrate/20191017092449_migrate_competition_score.rb
delete mode 100644 db/migrate/20191018015007_create_shixun_reviews.rb
delete mode 100644 db/migrate/20191018022821_create_competition_awards.rb
delete mode 100644 db/migrate/20191018030029_add_rate_to_competition_stage.rb
delete mode 100644 db/migrate/20191019075105_create_module_settings.rb
delete mode 100644 db/migrate/20191019082903_change_column_competition_stage.rb
delete mode 100644 db/migrate/20191021141738_migrate_exercise_challenge_score.rb
delete mode 100644 db/migrate/20191021150220_migrate_exercise_answer_score.rb
delete mode 100644 db/migrate/20191021154016_migrate_2734_exercise_answer_score.rb
delete mode 100644 db/migrate/20191022003750_create_weapp_settings.rb
delete mode 100644 db/migrate/20191022030127_migrate_competition_score_stage_id.rb
delete mode 100644 db/migrate/20191022075223_migrate_competition_mode_default.rb
delete mode 100644 db/migrate/20191022100044_add_awards_count_to_competition.rb
delete mode 100644 db/migrate/20191023074837_migrate_competition_module_type.rb
delete mode 100644 db/migrate/20191024055404_migrate_com_module_resource.rb
delete mode 100644 db/migrate/20191024075134_migrate_competition_module_manual.rb
delete mode 100644 db/migrate/20191024083706_migrate_competition_module_content.rb
delete mode 100644 db/migrate/20191024090740_migrate_competition_chart_rules.rb
delete mode 100644 db/migrate/20191024105504_create_competition_schools.rb
delete mode 100644 db/migrate/20191025012950_add_column_to_stage_sections.rb
delete mode 100644 db/migrate/20191026110116_migrate_chart_rule.rb
delete mode 100644 db/migrate/20191028025241_re_counter_course_groups.rb
delete mode 100644 db/migrate/20191029003245_create_competition_managers.rb
delete mode 100644 db/migrate/20191029011040_add_statistics_to_course_module.rb
delete mode 100644 db/migrate/20191029065244_init_trustie_config.rb
delete mode 100644 db/migrate/20191029084344_add_total_score_to_homework_commons.rb
delete mode 100644 db/migrate/20191030005223_init_competition_certificate_module_data.rb
delete mode 100644 db/migrate/20191030013802_create_competition_prizes.rb
delete mode 100644 db/migrate/20191030055341_create_competition_prize_users.rb
delete mode 100644 db/migrate/20191030062150_create_exercise_user_scores.rb
delete mode 100644 db/migrate/20191104033349_create_game_answers.rb
delete mode 100644 db/migrate/20191104055038_add_index_for_game_answers.rb
delete mode 100644 db/migrate/20191104063136_add_team_title_to_subjects.rb
delete mode 100644 db/migrate/20191104080912_add_email_notify_to_course.rb
delete mode 100644 db/migrate/20191104132649_migrate_2796_exercise_score.rb
delete mode 100644 db/migrate/20191105093740_create_trustie_hackathons.rb
delete mode 100644 db/migrate/20191105093919_create_trustie_hacks.rb
delete mode 100644 db/migrate/20191105094146_create_hack_users.rb
delete mode 100644 db/migrate/20191106015717_create_partner_manager_groups.rb
delete mode 100644 db/migrate/20191106020241_create_partner_managers.rb
delete mode 100644 db/migrate/20191106020505_transfer_partner_manager_data.rb
delete mode 100644 db/migrate/20191106021452_remove_partner_id_from_users.rb
delete mode 100644 db/migrate/20191106034825_add_trustie_hackathon_id_for_trustie_hacks.rb
delete mode 100644 db/migrate/20191106055638_migrate_2808_exercise_score.rb
delete mode 100644 db/migrate/20191106061342_add_uniq_index_for_hack_users.rb
delete mode 100644 db/migrate/20191106070243_create_laboratory_shixuns.rb
delete mode 100644 db/migrate/20191106094429_add_position_for_informs.rb
delete mode 100644 db/migrate/20191107023418_create_laboratory_subjects.rb
delete mode 100644 db/migrate/20191107062552_add_email_notify_to_messages.rb
delete mode 100644 db/migrate/20191107093428_add_column_to_exercise_user_score.rb
delete mode 100644 db/migrate/20191108070703_modify_descriotion_limit_for_hacks.rb
delete mode 100644 db/migrate/20191111082252_create_hacks.rb
delete mode 100644 db/migrate/20191111083528_create_hack_codes.rb
delete mode 100644 db/migrate/20191111100954_create_hack_sets.rb
delete mode 100644 db/migrate/20191111101536_create_hack_user_codes.rb
delete mode 100644 db/migrate/20191112010611_create_hack_user_lastest_codes.rb
delete mode 100644 db/migrate/20191112012007_create_hack_user_debugs.rb
delete mode 100644 db/migrate/20191112023111_add_defualt_for_hacks.rb
delete mode 100644 db/migrate/20191112100418_migrate_gcc_project_team.rb
delete mode 100644 db/migrate/20191112100820_add_score_for_hacks.rb
delete mode 100644 db/migrate/20191113013258_gcc_course_competition_rank_data.rb
delete mode 100644 db/migrate/20191113061866_add_status_end_time_for_hack_user_lastest_code.rb
delete mode 100644 db/migrate/20191114073028_add_sticky_to_course_members.rb
delete mode 100644 db/migrate/20191115011229_add_laboratory_id_to_courses.rb
delete mode 100644 db/migrate/20191115012535_add_laboratory_id_to_competitions.rb
delete mode 100644 db/migrate/20191115053209_add_laboratory_id_to_users.rb
delete mode 100644 db/migrate/20191115060527_add_copy_from_for_subjects.rb
delete mode 100644 db/migrate/20191115070508_add_laboratory_id_to_libraries.rb
delete mode 100644 db/migrate/20191115070841_transfer_laboratory_data.rb
delete mode 100644 db/migrate/20191115121529_add_laborary_id_for_shixun.rb
delete mode 100644 db/migrate/20191118113842_add_hack_user_lastest_code_id_for_hack_user_code.rb
delete mode 100644 db/migrate/20191119064245_add_sync_course_to_laboratory_settings.rb
delete mode 100644 db/migrate/20191120012538_remove_pass_time_for_hack_user_lastest_codes.rb
delete mode 100644 db/migrate/20191120080224_migrate_eff_score_default.rb
delete mode 100644 db/migrate/20191120123353_add_code_forhack_user_debugs.rb
delete mode 100644 db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb
delete mode 100644 db/migrate/20191129064841_add_sync_shixun_subject_to_laboratory.rb
delete mode 100644 db/migrate/20191203032557_add_uniq_index_to_exercise_answer.rb
delete mode 100644 db/migrate/20191203040140_add_uniq_index_to_poll_votes.rb
delete mode 100644 db/migrate/20191203122643_add_index_to_exercise_answers.rb
delete mode 100644 db/migrate/20191203124903_add_index_to_exercise_choice.rb
delete mode 100644 db/migrate/20191203124938_add_index_to_poll_answer.rb
diff --git a/db/migrate/20180920063955_create_graduation_topics.rb b/db/migrate/20180920063955_create_graduation_topics.rb
deleted file mode 100644
index 5e7a4640e..000000000
--- a/db/migrate/20180920063955_create_graduation_topics.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-class CreateGraduationTopics < ActiveRecord::Migration[5.2]
- def change
- create_table :graduation_topics do |t|
- t.references :user
- t.references :course
- t.integer :tea_id
- t.string :name
- t.text :description
- t.integer :status, :default => 0
- t.integer :topic_type
- t.integer :source
- t.integer :property
- t.integer :property_two
- t.string :source_unit
- t.integer :repeat
- t.string :province
- t.string :city
- t.boolean :is_public, :default => 0
-
- t.timestamps
- end
- add_index :graduation_topics, :user_id
- add_index :graduation_topics, :course_id
- add_index :graduation_topics, :tea_id
- end
-end
diff --git a/db/migrate/20181024015607_add_column_to_poll.rb b/db/migrate/20181024015607_add_column_to_poll.rb
deleted file mode 100644
index 65ebe98d3..000000000
--- a/db/migrate/20181024015607_add_column_to_poll.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddColumnToPoll < ActiveRecord::Migration[5.2]
- # 问卷是否实名
- def change
- add_column :polls, :un_anonymous, :boolean, :default => 0
- end
-end
diff --git a/db/migrate/20181105031300_add_repo_name_to_shixuns.rb b/db/migrate/20181105031300_add_repo_name_to_shixuns.rb
deleted file mode 100644
index 3210184ad..000000000
--- a/db/migrate/20181105031300_add_repo_name_to_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddRepoNameToShixuns < ActiveRecord::Migration[5.2]
- def change
- add_column :shixuns, :repo_name, :string
- end
-end
diff --git a/db/migrate/20181105061745_add_repo_name_to_myshixuns.rb b/db/migrate/20181105061745_add_repo_name_to_myshixuns.rb
deleted file mode 100644
index 70ca92abb..000000000
--- a/db/migrate/20181105061745_add_repo_name_to_myshixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddRepoNameToMyshixuns < ActiveRecord::Migration[5.2]
- def change
- add_column :myshixuns, :repo_name, :string
- end
-end
diff --git a/db/migrate/20181115071148_create_relationships.rb b/db/migrate/20181115071148_create_relationships.rb
deleted file mode 100644
index 4437e9ea5..000000000
--- a/db/migrate/20181115071148_create_relationships.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class CreateRelationships < ActiveRecord::Migration[5.2]
- def change
- create_table :relationships do |t|
- t.integer :follower_id
- t.integer :followed_id
-
- t.timestamps
- end
- add_index :relationships, :followed_id
- add_index :relationships, :follower_id
- add_index :relationships, [:follower_id, :followed_id], unique: true
- end
-end
diff --git a/db/migrate/20181118075620_sync_gitlab_admin.rb b/db/migrate/20181118075620_sync_gitlab_admin.rb
deleted file mode 100644
index 17cb3bd18..000000000
--- a/db/migrate/20181118075620_sync_gitlab_admin.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class SyncGitlabAdmin < ActiveRecord::Migration[5.2]
- def change
- user = User.find_by_login("forge01")
- user.update_column(:mail, 'admin@example.com')
- end
-end
diff --git a/db/migrate/20181207064509_add_cloud_url_to_attachments.rb b/db/migrate/20181207064509_add_cloud_url_to_attachments.rb
deleted file mode 100644
index 6dd3ffb6d..000000000
--- a/db/migrate/20181207064509_add_cloud_url_to_attachments.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddCloudUrlToAttachments < ActiveRecord::Migration[5.2]
- def change
- add_column :attachments, :cloud_url, :string, default: ''
- end
-end
diff --git a/db/migrate/20181213024859_add_averge_star_to_shixuns.rb b/db/migrate/20181213024859_add_averge_star_to_shixuns.rb
deleted file mode 100644
index c801c8675..000000000
--- a/db/migrate/20181213024859_add_averge_star_to_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddAvergeStarToShixuns < ActiveRecord::Migration[5.2]
- def change
- add_column :shixuns, :averge_star, :float, :default => 0
- end
-end
diff --git a/db/migrate/20181213025239_sync_averger_star_to_shixun.rb b/db/migrate/20181213025239_sync_averger_star_to_shixun.rb
deleted file mode 100644
index e117475a4..000000000
--- a/db/migrate/20181213025239_sync_averger_star_to_shixun.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class SyncAvergerStarToShixun < ActiveRecord::Migration[5.2]
- def change
- Shixun.find_each do |shixun|
- averge_star = Game.find_by_sql("select ifnull(sum(g.star),0)/ifnull(count(*),1) as averge_star from (games g left join
- (myshixuns m join shixuns s on s.id = m.shixun_id) on m.id = g.myshixun_id)
- where star != 0 and s.id = #{shixun.id}").first.try(:averge_star)
- averge_star = averge_star || 5
- puts(averge_star)
- shixun.update_column(:averge_star, averge_star.round(1))
- end
- end
-end
diff --git a/db/migrate/20181228095820_create_shixun_infos.rb b/db/migrate/20181228095820_create_shixun_infos.rb
deleted file mode 100644
index f5c72d5a3..000000000
--- a/db/migrate/20181228095820_create_shixun_infos.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class CreateShixunInfos < ActiveRecord::Migration[5.2]
- def change
- create_table :shixun_infos do |t|
- t.longtext :propaedeutics
- t.longtext :description
- t.longtext :evaluate_script
- t.integer :shixun_id
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20181228115324_add_index_to_users.rb b/db/migrate/20181228115324_add_index_to_users.rb
deleted file mode 100644
index ccd8f771f..000000000
--- a/db/migrate/20181228115324_add_index_to_users.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIndexToUsers < ActiveRecord::Migration[5.2]
- def change
- add_index :users, :experience
- end
-end
diff --git a/db/migrate/20190108074759_modify_status_and_visits_for_subjects.rb b/db/migrate/20190108074759_modify_status_and_visits_for_subjects.rb
deleted file mode 100644
index 08a5d0e3a..000000000
--- a/db/migrate/20190108074759_modify_status_and_visits_for_subjects.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class ModifyStatusAndVisitsForSubjects < ActiveRecord::Migration[5.2]
- def change
- change_column :subjects, :status, :integer, :default => 0
- change_column :subjects, :visits, :integer, :default => 1
- end
-end
diff --git a/db/migrate/20190109005614_add_opening_time_for_shixuns.rb b/db/migrate/20190109005614_add_opening_time_for_shixuns.rb
deleted file mode 100644
index d02cd6113..000000000
--- a/db/migrate/20190109005614_add_opening_time_for_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddOpeningTimeForShixuns < ActiveRecord::Migration[5.2]
- def change
- add_column :shixuns, :opening_time, :string
- end
-end
diff --git a/db/migrate/20190109013210_modify_opening_time_for_shixuns.rb b/db/migrate/20190109013210_modify_opening_time_for_shixuns.rb
deleted file mode 100644
index b3360c424..000000000
--- a/db/migrate/20190109013210_modify_opening_time_for_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ModifyOpeningTimeForShixuns < ActiveRecord::Migration[5.2]
- def change
- change_column :shixuns, :opening_time, :datetime
- end
-end
diff --git a/db/migrate/20190111063956_add_averge_star_default_for_shixuns.rb b/db/migrate/20190111063956_add_averge_star_default_for_shixuns.rb
deleted file mode 100644
index fb0b4d3aa..000000000
--- a/db/migrate/20190111063956_add_averge_star_default_for_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddAvergeStarDefaultForShixuns < ActiveRecord::Migration[5.2]
- def change
- change_column :shixuns, :averge_star, :float, :default => 5
- end
-end
diff --git a/db/migrate/20190120063702_sync_reponame.rb b/db/migrate/20190120063702_sync_reponame.rb
deleted file mode 100644
index c40eba131..000000000
--- a/db/migrate/20190120063702_sync_reponame.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class SyncReponame < ActiveRecord::Migration[5.2]
- def change
- g = Gitlab.client
- myshixuns = Myshixun.where("repo_name is null")
- myshixuns.find_each do |myshixun|
- begin
- puts myshixun.id
- repo_name = g.project(myshixun.gpid).path_with_namespace
- puts repo_name
- myshixun.update_column(:repo_name, repo_name)
- rescue Exception => e
- Rails.logger.error("e.message")
- end
- end
- end
-end
diff --git a/db/migrate/20190220014052_add_shixuns_count_to_stage.rb b/db/migrate/20190220014052_add_shixuns_count_to_stage.rb
deleted file mode 100644
index caf459a8e..000000000
--- a/db/migrate/20190220014052_add_shixuns_count_to_stage.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddShixunsCountToStage < ActiveRecord::Migration[5.2]
- def change
- add_column :stages, :shixuns_count, :integer, default: 0
- end
-end
diff --git a/db/migrate/20190220061013_add_shixuns_count_to_subject.rb b/db/migrate/20190220061013_add_shixuns_count_to_subject.rb
deleted file mode 100644
index 3f803d2f1..000000000
--- a/db/migrate/20190220061013_add_shixuns_count_to_subject.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddShixunsCountToSubject < ActiveRecord::Migration[5.2]
- def change
- add_column :subjects, :shixuns_count, :integer, default: 0
- end
-end
diff --git a/db/migrate/20190220074947_sync_cache_count_for_subjects.rb b/db/migrate/20190220074947_sync_cache_count_for_subjects.rb
deleted file mode 100644
index ce2b22d62..000000000
--- a/db/migrate/20190220074947_sync_cache_count_for_subjects.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class SyncCacheCountForSubjects < ActiveRecord::Migration[5.2]
- def change
- Subject.find_each do |s|
- Subject.reset_counters s.id, :shixuns
- Subject.reset_counters s.id, :stages
- end
- end
-end
diff --git a/db/migrate/20190221003048_add_users_count_to_shixun.rb b/db/migrate/20190221003048_add_users_count_to_shixun.rb
deleted file mode 100644
index dffca5be9..000000000
--- a/db/migrate/20190221003048_add_users_count_to_shixun.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddUsersCountToShixun < ActiveRecord::Migration[5.2]
- def change
- add_column :shixuns, :users_count, :integer, default: 0
- end
-end
diff --git a/db/migrate/20190221003137_sync_users_count_for_shixun.rb b/db/migrate/20190221003137_sync_users_count_for_shixun.rb
deleted file mode 100644
index 155ddda58..000000000
--- a/db/migrate/20190221003137_sync_users_count_for_shixun.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class SyncUsersCountForShixun < ActiveRecord::Migration[5.2]
- def change
- Shixun.find_each do |s|
- Shixun.reset_counters s.id, :users_count
- end
- end
-end
diff --git a/db/migrate/20190228030508_delete_none_myshixun_games.rb b/db/migrate/20190228030508_delete_none_myshixun_games.rb
deleted file mode 100644
index 89130d3fa..000000000
--- a/db/migrate/20190228030508_delete_none_myshixun_games.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class DeleteNoneMyshixunGames < ActiveRecord::Migration[5.2]
- def change
- games = Game.where.not(myshixun_id: Myshixun.where(nil).pluck(:id))
- games.destroy_all
- end
-end
diff --git a/db/migrate/20190304082236_create_challenge_answers.rb b/db/migrate/20190304082236_create_challenge_answers.rb
deleted file mode 100644
index 630c92661..000000000
--- a/db/migrate/20190304082236_create_challenge_answers.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class CreateChallengeAnswers < ActiveRecord::Migration[5.2]
- def change
- create_table :challenge_answers do |t|
- t.string :name
- t.longtext :contents
- t.integer :score
- t.integer :level
- t.references :challenge, index: true
- t.timestamps
- end
-
- end
-end
diff --git a/db/migrate/20190304082811_create_course_members.rb b/db/migrate/20190304082811_create_course_members.rb
deleted file mode 100644
index fd54891fd..000000000
--- a/db/migrate/20190304082811_create_course_members.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class CreateCourseMembers < ActiveRecord::Migration[5.2]
- def change
- create_table :course_members do |t|
- t.integer :course_id
- t.integer :user_id
- t.integer :course_group_id, default: 0
- t.integer :graduation_group_id, default: 0
- t.integer :role, default: 0
- t.boolean :is_active, default: 1
-
- t.timestamps
- end
-
- add_index :course_members, :course_id
- add_index :course_members, :user_id
- add_index :course_members, :course_group_id
- add_index :course_members, :graduation_group_id
- end
-end
diff --git a/db/migrate/20190305015556_modify_answer_open_for_games.rb b/db/migrate/20190305015556_modify_answer_open_for_games.rb
deleted file mode 100644
index 7ae83ac9e..000000000
--- a/db/migrate/20190305015556_modify_answer_open_for_games.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ModifyAnswerOpenForGames < ActiveRecord::Migration[5.2]
- def change
- change_column :games, :answer_open, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190305074102_add_checkout_answer_score_for_games.rb b/db/migrate/20190305074102_add_checkout_answer_score_for_games.rb
deleted file mode 100644
index 9c026fc3f..000000000
--- a/db/migrate/20190305074102_add_checkout_answer_score_for_games.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddCheckoutAnswerScoreForGames < ActiveRecord::Migration[5.2]
- def change
- add_column :games, :answer_deduction, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190305080703_add_course_members_count_to_course.rb b/db/migrate/20190305080703_add_course_members_count_to_course.rb
deleted file mode 100644
index d38aaca5b..000000000
--- a/db/migrate/20190305080703_add_course_members_count_to_course.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddCourseMembersCountToCourse < ActiveRecord::Migration[5.2]
- def change
- add_column :courses, :course_members_count, :integer, default: 0
-
- Course.find_each do |c|
- Course.reset_counters c.id, :course_members
- end
- end
-end
diff --git a/db/migrate/20190306023331_add_score_for_test_sets.rb b/db/migrate/20190306023331_add_score_for_test_sets.rb
deleted file mode 100644
index 08b67ad85..000000000
--- a/db/migrate/20190306023331_add_score_for_test_sets.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddScoreForTestSets < ActiveRecord::Migration[5.2]
- def change
- add_column :test_sets, :score, :integer
- add_column :challenges, :test_set_score, :boolean, :default => false
- end
-end
diff --git a/db/migrate/20190306064421_add_answer_for_challenge_answer.rb b/db/migrate/20190306064421_add_answer_for_challenge_answer.rb
deleted file mode 100644
index 32a6a6aa2..000000000
--- a/db/migrate/20190306064421_add_answer_for_challenge_answer.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddAnswerForChallengeAnswer < ActiveRecord::Migration[5.2]
- def change
- challenges = Challenge.where("answer is not null")
- challenges.find_each do |c|
- puts "####################{c.id}"
- ChallengeAnswer.create(name: "解题代码", contents: "#{c.answer}", level: 1, score: 100, challenge_id: c.id)
- end
-
- end
-end
diff --git a/db/migrate/20190307063217_add_pod_life_to_shixuns.rb b/db/migrate/20190307063217_add_pod_life_to_shixuns.rb
deleted file mode 100644
index e596367f2..000000000
--- a/db/migrate/20190307063217_add_pod_life_to_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddPodLifeToShixuns < ActiveRecord::Migration[5.2]
- def change
- add_column :shixuns, :pod_life, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190309085449_migrate_course_members.rb b/db/migrate/20190309085449_migrate_course_members.rb
deleted file mode 100644
index a6d049dd7..000000000
--- a/db/migrate/20190309085449_migrate_course_members.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-class MigrateCourseMembers < ActiveRecord::Migration[5.2]
- def change
- # add_column :course_groups, :position, :integer, default: 0
-
- Course.find_each do |course|
- position = 1
- course.course_groups.reorder("CONVERT(course_groups.name USING gbk) COLLATE gbk_chinese_ci ASC").each do |group|
- group.update_attribute(:position, position)
- position += 1
- end
- end
-
-
- add_column :course_groups, :course_members_count, :integer, default: 0
-
- CourseGroup.find_each do |g|
- CourseGroup.reset_counters g.id, :course_members
- end
-
- ActiveRecord::Base.transaction do
- begin
- Member.where("course_id != -1").includes(:member_roles).find_each(batch_size: 500) do |member|
- puts(member.id)
- member.member_roles.each do |role|
- course_member_role = role.role_id == 3 ? 1 : (role.role_id == 9 ? 2 : (role.role_id == 7 ? 3 : 4))
- member_group_id = role.role_id == 10 ? member.course_group_id : 0
- CourseMember.create!(course_id: member.course_id, user_id: member.user_id, course_group_id: member_group_id,
- graduation_group_id: member.graduation_group_id, role: course_member_role, is_active: role.is_current)
- end
- end
- rescue Exception => e
- uid_logger_error(e.message)
- tip_exception("migrate_course_members 迁移失败!")
- raise ActiveRecord::Rollback
- end
- end
- end
-end
diff --git a/db/migrate/20190309091056_add_course_member_id.rb b/db/migrate/20190309091056_add_course_member_id.rb
deleted file mode 100644
index 86993d725..000000000
--- a/db/migrate/20190309091056_add_course_member_id.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class AddCourseMemberId < ActiveRecord::Migration[5.2]
- def change
- add_column :student_graduation_topics, :course_member_id, :integer
- add_index :student_graduation_topics, :course_member_id
-
- StudentGraduationTopic.find_each do |student|
- course_member = CourseMember.where(course_id: student.course_id, user_id: student.user_id,
- role: 4).first
- student.update_column("course_member_id", course_member.try(:id)) if course_member.present?
- end
-
- add_column :teacher_course_groups, :course_member_id, :integer
- add_index :teacher_course_groups, :course_member_id
-
- TeacherCourseGroup.find_each do |teacher|
- course_member = CourseMember.where(course_id: teacher.course_id, user_id: teacher.user_id,
- role: [1, 2, 3]).first
- teacher.update_column("course_member_id", course_member.try(:id)) if course_member.present?
- end
- end
-end
diff --git a/db/migrate/20190311064138_add_course_groups_count_to_course.rb b/db/migrate/20190311064138_add_course_groups_count_to_course.rb
deleted file mode 100644
index ecd11e7cb..000000000
--- a/db/migrate/20190311064138_add_course_groups_count_to_course.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddCourseGroupsCountToCourse < ActiveRecord::Migration[5.2]
- def change
- add_column :courses, :course_groups_count, :integer, default: 0
-
- Course.find_each do |c|
- Course.reset_counters c.id, :course_groups
- end
- end
-end
diff --git a/db/migrate/20190311080729_add_position_to_course_groups.rb b/db/migrate/20190311080729_add_position_to_course_groups.rb
deleted file mode 100644
index 4a59a7d97..000000000
--- a/db/migrate/20190311080729_add_position_to_course_groups.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddPositionToCourseGroups < ActiveRecord::Migration[5.2]
- def change
-
- end
-end
diff --git a/db/migrate/20190311090818_create_course_second_categories.rb b/db/migrate/20190311090818_create_course_second_categories.rb
deleted file mode 100644
index 51850c2fd..000000000
--- a/db/migrate/20190311090818_create_course_second_categories.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class CreateCourseSecondCategories < ActiveRecord::Migration[5.2]
- def change
- create_table :course_second_categories do |t|
- t.references :course
- t.string :category_type
- t.string :name
- t.integer :position
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190312024018_migrate_course_second_category.rb b/db/migrate/20190312024018_migrate_course_second_category.rb
deleted file mode 100644
index 382c6fd6f..000000000
--- a/db/migrate/20190312024018_migrate_course_second_category.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class MigrateCourseSecondCategory < ActiveRecord::Migration[5.2]
- def change
- add_column :homework_commons, :course_second_category_id, :integer, default: 0
- add_index :homework_commons, :course_second_category_id
- add_column :course_second_categories, :course_module_id, :integer
- add_index :course_second_categories, :course_module_id
-
- Course.find_each do |course|
- homework_position = 1
- course_module = course.course_modules.where(module_type: "shixun_homework").first
- course.course_homework_categories.reorder("CONVERT(name USING gbk) COLLATE gbk_chinese_ci ASC").find_each do |category|
- new_category = CourseSecondCategory.create!(course_id: course.id, name: category.name, category_type: "shixun_homework",
- position: homework_position, course_module_id: course_module.id)
- course.homework_commons.where(course_homework_category_id: category.id).update_all(course_second_category_id: new_category.id)
- homework_position += 1
- end
- end
- end
-end
diff --git a/db/migrate/20190312032623_add_course_second_category_to_attachment.rb b/db/migrate/20190312032623_add_course_second_category_to_attachment.rb
deleted file mode 100644
index 972422e43..000000000
--- a/db/migrate/20190312032623_add_course_second_category_to_attachment.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddCourseSecondCategoryToAttachment < ActiveRecord::Migration[5.2]
- def change
- add_column :attachments, :course_second_category_id, :integer, default: 0
- add_index :attachments, :course_second_category_id
- end
-end
diff --git a/db/migrate/20190321081720_add_praises_count_to_messages.rb b/db/migrate/20190321081720_add_praises_count_to_messages.rb
deleted file mode 100644
index 14f9260cb..000000000
--- a/db/migrate/20190321081720_add_praises_count_to_messages.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class AddPraisesCountToMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :messages, :praises_count, :integer, :default => 0
-
- Message.find_each do |msg|
- total_count = msg.praise_treads.liker.count
- puts "====> set message's praises_count to #{total_count}"
- msg.update_column(:praises_count, total_count)
- end
- end
-end
diff --git a/db/migrate/20190321091429_change_praise_or_tread_default_in_praise_treads.rb b/db/migrate/20190321091429_change_praise_or_tread_default_in_praise_treads.rb
deleted file mode 100644
index 15dd3f6e9..000000000
--- a/db/migrate/20190321091429_change_praise_or_tread_default_in_praise_treads.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ChangePraiseOrTreadDefaultInPraiseTreads < ActiveRecord::Migration[5.2]
- def change
- change_column_default :praise_treads, :praise_or_tread, from: nil, to: 1
- end
-end
diff --git a/db/migrate/20190322065716_create_message_details.rb b/db/migrate/20190322065716_create_message_details.rb
deleted file mode 100644
index 5fd1ba7d8..000000000
--- a/db/migrate/20190322065716_create_message_details.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateMessageDetails < ActiveRecord::Migration[5.2]
- def change
- create_table :message_details do |t|
- t.longtext :content
- t.integer :message_id
-
- t.timestamps
- end
- add_index :message_details, :message_id
- end
-end
diff --git a/db/migrate/20190322070515_move_content_of_messages_to_message_details.rb b/db/migrate/20190322070515_move_content_of_messages_to_message_details.rb
deleted file mode 100644
index be747c898..000000000
--- a/db/migrate/20190322070515_move_content_of_messages_to_message_details.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class MoveContentOfMessagesToMessageDetails < ActiveRecord::Migration[5.2]
- def change
- Message.find_each do |msg|
- unless msg.message_detail.present?
- message_detail = MessageDetail.create(message: msg, content: msg.content)
- puts "-------> create MessageDetail success: id is #{message_detail.id}"
- end
- end
- end
-end
diff --git a/db/migrate/20190322091313_remove_content_from_messages.rb b/db/migrate/20190322091313_remove_content_from_messages.rb
deleted file mode 100644
index ee6830e53..000000000
--- a/db/migrate/20190322091313_remove_content_from_messages.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class RemoveContentFromMessages < ActiveRecord::Migration[5.2]
- def change
- remove_column :messages, :content, :longtext
- end
-end
diff --git a/db/migrate/20190323005303_modify_graduation_topics.rb b/db/migrate/20190323005303_modify_graduation_topics.rb
deleted file mode 100644
index 18998fdcd..000000000
--- a/db/migrate/20190323005303_modify_graduation_topics.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class ModifyGraduationTopics < ActiveRecord::Migration[5.2]
- def change
- rename_column :graduation_topics, :source, :topic_source
- rename_column :graduation_topics, :property, :topic_property_first
- rename_column :graduation_topics, :property_two, :topic_property_second
- rename_column :graduation_topics, :repeat, :topic_repeat
- end
-end
diff --git a/db/migrate/20190325022227_add_is_public_to_graduation_task.rb b/db/migrate/20190325022227_add_is_public_to_graduation_task.rb
deleted file mode 100644
index 159aa90e9..000000000
--- a/db/migrate/20190325022227_add_is_public_to_graduation_task.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class AddIsPublicToGraduationTask < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_tasks, :is_public, :boolean, default: false
- add_column :graduation_tasks, :late_time, :datetime
-
- GraduationTask.where(status: 3).update_all(status: 4)
- end
-end
diff --git a/db/migrate/20190325023830_change_digest_to_string_in_attachments.rb b/db/migrate/20190325023830_change_digest_to_string_in_attachments.rb
deleted file mode 100644
index 3b59e56e8..000000000
--- a/db/migrate/20190325023830_change_digest_to_string_in_attachments.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ChangeDigestToStringInAttachments < ActiveRecord::Migration[5.2]
- def change
- change_column :attachments, :digest, :string, :limit => 60
- end
-end
diff --git a/db/migrate/20190326015900_add_hidden_for_journal_for_messages.rb b/db/migrate/20190326015900_add_hidden_for_journal_for_messages.rb
deleted file mode 100644
index 2ff25360d..000000000
--- a/db/migrate/20190326015900_add_hidden_for_journal_for_messages.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddHiddenForJournalForMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :journals_for_messages, :hidden, :boolean, :default => false
- end
-end
diff --git a/db/migrate/20190326095920_add_is_hidden_to_messages.rb b/db/migrate/20190326095920_add_is_hidden_to_messages.rb
deleted file mode 100644
index ee97a3f6c..000000000
--- a/db/migrate/20190326095920_add_is_hidden_to_messages.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddIsHiddenToMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :messages, :is_hidden, :boolean, :default => false
- add_index :messages, :is_hidden
- end
-end
diff --git a/db/migrate/20190327063241_course_group_count_cache.rb b/db/migrate/20190327063241_course_group_count_cache.rb
deleted file mode 100644
index cf0b868ff..000000000
--- a/db/migrate/20190327063241_course_group_count_cache.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class CourseGroupCountCache < ActiveRecord::Migration[5.2]
- def change
-
- end
-end
diff --git a/db/migrate/20190329091942_add_index_to_shixun_infos.rb b/db/migrate/20190329091942_add_index_to_shixun_infos.rb
deleted file mode 100644
index c7a14dfaa..000000000
--- a/db/migrate/20190329091942_add_index_to_shixun_infos.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIndexToShixunInfos < ActiveRecord::Migration[5.2]
- def change
- add_index :shixun_infos, :shixun_id, unique: true
- end
-end
diff --git a/db/migrate/20190401083919_change_quotes_to_integer_in_attachments.rb b/db/migrate/20190401083919_change_quotes_to_integer_in_attachments.rb
deleted file mode 100644
index 4e25ab522..000000000
--- a/db/migrate/20190401083919_change_quotes_to_integer_in_attachments.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class ChangeQuotesToIntegerInAttachments < ActiveRecord::Migration[5.2]
- def change
- change_column :attachments, :quotes, :integer, :default => 0
- add_index :attachments, :quotes
- end
-end
diff --git a/db/migrate/20190401094623_add_index_to_attachments_is_public.rb b/db/migrate/20190401094623_add_index_to_attachments_is_public.rb
deleted file mode 100644
index d098253d0..000000000
--- a/db/migrate/20190401094623_add_index_to_attachments_is_public.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIndexToAttachmentsIsPublic < ActiveRecord::Migration[5.2]
- def change
- add_index :attachments, :is_public
- end
-end
diff --git a/db/migrate/20190402015918_add_invalid_to_graduation_work_score.rb b/db/migrate/20190402015918_add_invalid_to_graduation_work_score.rb
deleted file mode 100644
index 5a7ea9c16..000000000
--- a/db/migrate/20190402015918_add_invalid_to_graduation_work_score.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddInvalidToGraduationWorkScore < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_work_scores, :is_invalid, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190402083252_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20190402083252_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
deleted file mode 100644
index b4bc9a2f6..000000000
--- a/db/migrate/20190402083252_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 1)
-if ActiveRecord.gem_version >= Gem::Version.new('5.0')
- class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2]; end
-else
- class ActsAsTaggableOnMigration < ActiveRecord::Migration; end
-end
-ActsAsTaggableOnMigration.class_eval do
- def self.up
- unless ActiveRecord::Base.connection.table_exists? 'tags'
- create_table :tags do |t|
- t.string :name
- end
- end
-
- unless ActiveRecord::Base.connection.table_exists? 'taggings'
- create_table :taggings do |t|
- t.references :tag
-
- # You should make sure that the column created is
- # long enough to store the required class names.
- t.references :taggable, polymorphic: true
- t.references :tagger, polymorphic: true
-
- # Limit is created to prevent MySQL error on index
- # length for MyISAM table type: http://bit.ly/vgW2Ql
- t.string :context, limit: 128
-
- t.datetime :created_at
- end
- end
-
- # add_index :taggings, :tag_id
- # add_index :taggings, [:taggable_id, :taggable_type, :context]
- end
-
- def self.down
- drop_table :taggings
- drop_table :tags
- end
-end
diff --git a/db/migrate/20190402083253_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20190402083253_add_missing_unique_indices.acts_as_taggable_on_engine.rb
deleted file mode 100644
index 7206c90e6..000000000
--- a/db/migrate/20190402083253_add_missing_unique_indices.acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 2)
-if ActiveRecord.gem_version >= Gem::Version.new('5.0')
- class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]; end
-else
- class AddMissingUniqueIndices < ActiveRecord::Migration; end
-end
-AddMissingUniqueIndices.class_eval do
- def self.up
- # add_index :tags, :name, unique: true
-
- remove_index :taggings, :tag_id if index_exists?(:taggings, :tag_id)
- remove_index :taggings, [:taggable_id, :taggable_type, :context]
- add_index :taggings,
- [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
- unique: true, name: 'taggings_idx'
- end
-
- def self.down
- remove_index :tags, :name
-
- remove_index :taggings, name: 'taggings_idx'
-
- add_index :taggings, :tag_id unless index_exists?(:taggings, :tag_id)
- add_index :taggings, [:taggable_id, :taggable_type, :context]
- end
-end
diff --git a/db/migrate/20190402083254_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20190402083254_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
deleted file mode 100644
index 5409eef63..000000000
--- a/db/migrate/20190402083254_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 3)
-if ActiveRecord.gem_version >= Gem::Version.new('5.0')
- class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]; end
-else
- class AddTaggingsCounterCacheToTags < ActiveRecord::Migration; end
-end
-AddTaggingsCounterCacheToTags.class_eval do
- def self.up
- add_column :tags, :taggings_count, :integer, default: 0
-
- ActsAsTaggableOn::Tag.reset_column_information
- ActsAsTaggableOn::Tag.find_each do |tag|
- ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
- end
- end
-
- def self.down
- remove_column :tags, :taggings_count
- end
-end
diff --git a/db/migrate/20190402083255_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20190402083255_add_missing_taggable_index.acts_as_taggable_on_engine.rb
deleted file mode 100644
index 097600b59..000000000
--- a/db/migrate/20190402083255_add_missing_taggable_index.acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 4)
-if ActiveRecord.gem_version >= Gem::Version.new('5.0')
- class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]; end
-else
- class AddMissingTaggableIndex < ActiveRecord::Migration; end
-end
-AddMissingTaggableIndex.class_eval do
- def self.up
- add_index :taggings, [:taggable_id, :taggable_type, :context]
- end
-
- def self.down
- remove_index :taggings, [:taggable_id, :taggable_type, :context]
- end
-end
diff --git a/db/migrate/20190402083256_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20190402083256_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
deleted file mode 100644
index 731f66c5a..000000000
--- a/db/migrate/20190402083256_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 5)
-# This migration is added to circumvent issue #623 and have special characters
-# work properly
-if ActiveRecord.gem_version >= Gem::Version.new('5.0')
- class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]; end
-else
- class ChangeCollationForTagNames < ActiveRecord::Migration; end
-end
-ChangeCollationForTagNames.class_eval do
- def up
- if ActsAsTaggableOn::Utils.using_mysql?
- execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
- end
- end
-end
diff --git a/db/migrate/20190402083257_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20190402083257_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
deleted file mode 100644
index 7073df2a2..000000000
--- a/db/migrate/20190402083257_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 6)
-if ActiveRecord.gem_version >= Gem::Version.new('5.0')
- class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
-else
- class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
-end
-AddMissingIndexesOnTaggings.class_eval do
- def change
- add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
- add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id
- add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type
- add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id
- add_index :taggings, :context unless index_exists? :taggings, :context
-
- unless index_exists? :taggings, [:tagger_id, :tagger_type]
- add_index :taggings, [:tagger_id, :tagger_type]
- end
-
- unless index_exists? :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
- add_index :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
- end
- end
-end
diff --git a/db/migrate/20190403022053_create_gtask_banks.rb b/db/migrate/20190403022053_create_gtask_banks.rb
deleted file mode 100644
index f7c7b4ffb..000000000
--- a/db/migrate/20190403022053_create_gtask_banks.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class CreateGtaskBanks < ActiveRecord::Migration[5.2]
- def change
- create_table :gtask_banks do |t|
- t.references :user
- t.string :name
- t.text :description
- t.integer :task_type
- t.integer :min_num, default: 0
- t.integer :max_num, default: 0
- t.integer :base_on_project, default: false
- t.boolean :is_public, default: false
- t.integer :quotes, default: 0
- t.references :graduation_task
- t.references :course_list
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190403025525_add_praises_count_for_jouranls_for_messages.rb b/db/migrate/20190403025525_add_praises_count_for_jouranls_for_messages.rb
deleted file mode 100644
index a175d64e5..000000000
--- a/db/migrate/20190403025525_add_praises_count_for_jouranls_for_messages.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class AddPraisesCountForJouranlsForMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :journals_for_messages, :praises_count, :integer, :default => 0
-
- messages = JournalsForMessage.includes(:praise_treads).all
- messages.find_each do |m|
- puts("####{m.id}")
- praises_count = m.praise_treads.liker.count
- m.update_column(:praises_count, praises_count)
- end
-
- end
-end
diff --git a/db/migrate/20190403065609_create_gtopic_banks.rb b/db/migrate/20190403065609_create_gtopic_banks.rb
deleted file mode 100644
index a4e280252..000000000
--- a/db/migrate/20190403065609_create_gtopic_banks.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class CreateGtopicBanks < ActiveRecord::Migration[5.2]
- def change
- create_table :gtopic_banks do |t|
- t.references :user
- t.string :name
- t.text :description
- t.integer :quotes
- t.boolean :is_public
- t.integer :topic_type
- t.integer :topic_source
- t.integer :topic_property_first
- t.integer :topic_property_second
- t.string :source_unit
- t.integer :topic_repeat
- t.string :province
- t.string :city
- t.references :graduation_topic
- t.references :course_list
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190408060723_add_is_ordered_to_exercise_standard_answers.rb b/db/migrate/20190408060723_add_is_ordered_to_exercise_standard_answers.rb
deleted file mode 100644
index 8ed2a6f8c..000000000
--- a/db/migrate/20190408060723_add_is_ordered_to_exercise_standard_answers.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddIsOrderedToExerciseStandardAnswers < ActiveRecord::Migration[5.2]
- def change
- #试题的多空标准答案是否为一一对应,默认为一一对应,即true
- add_column :exercise_standard_answers,:is_ordered,:boolean,:default => true
- end
-end
diff --git a/db/migrate/20190410033511_change_column_in_homeworks.rb b/db/migrate/20190410033511_change_column_in_homeworks.rb
deleted file mode 100644
index df8da9b43..000000000
--- a/db/migrate/20190410033511_change_column_in_homeworks.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class ChangeColumnInHomeworks < ActiveRecord::Migration[5.2]
- def change
- change_column_default :homework_commons, :late_penalty, from: nil, to: 5
- change_column_default :homework_commons, :anonymous_comment, from: 0, to: 1
- change_column_default :homework_commons, :work_efficiency, from: 1, to: 0
- change_column_default :homework_commons, :eff_score, from: 20, to: 0
- change_column_default :homework_detail_manuals, :ta_proportion, from: nil, to: 0
- change_column_default :homework_detail_manuals, :comment_status, from: nil, to: 0
- change_column_default :homework_detail_manuals, :evaluation_num, from: nil, to: 0
- change_column_default :homework_detail_manuals, :absence_penalty, from: 1, to: 0
- end
-end
diff --git a/db/migrate/20190410081421_change_is_ordered_from_answer_to_question.rb b/db/migrate/20190410081421_change_is_ordered_from_answer_to_question.rb
deleted file mode 100644
index ae7144c4e..000000000
--- a/db/migrate/20190410081421_change_is_ordered_from_answer_to_question.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class ChangeIsOrderedFromAnswerToQuestion < ActiveRecord::Migration[5.2]
- def change
- remove_column :exercise_standard_answers,:is_ordered
- add_column :exercise_questions,:is_ordered,:boolean,:default => true
- end
-end
diff --git a/db/migrate/20190410081736_migrate_homework_attachments.rb b/db/migrate/20190410081736_migrate_homework_attachments.rb
deleted file mode 100644
index fbdc26f6a..000000000
--- a/db/migrate/20190410081736_migrate_homework_attachments.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateHomeworkAttachments < ActiveRecord::Migration[5.2]
- def change
- Attachment.where(container_type: "HomeworkCommon").update_all(attachtype: 1)
- end
-end
diff --git a/db/migrate/20190413011125_add_cloud_url_to_attachment_histories.rb b/db/migrate/20190413011125_add_cloud_url_to_attachment_histories.rb
deleted file mode 100644
index a2f9db27d..000000000
--- a/db/migrate/20190413011125_add_cloud_url_to_attachment_histories.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddCloudUrlToAttachmentHistories < ActiveRecord::Migration[5.2]
- def change
- add_column :attachment_histories, :cloud_url, :string, default: ''
- end
-end
diff --git a/db/migrate/20190415090426_change_homework_common_columns.rb b/db/migrate/20190415090426_change_homework_common_columns.rb
deleted file mode 100644
index 11360d47f..000000000
--- a/db/migrate/20190415090426_change_homework_common_columns.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class ChangeHomeworkCommonColumns < ActiveRecord::Migration[5.2]
- def up
- change_column :homework_commons, :score_open, :boolean, default: 1
- change_column :homework_commons, :anonymous_comment, :boolean, default: 1
- change_column :homework_commons, :anonymous_appeal, :boolean, default: 0
- end
-
- def down
- change_column :homework_commons, :score_open, :int, default: 1
- change_column :homework_commons, :anonymous_comment, :int, default: 1
- change_column :homework_commons, :anonymous_appeal, :int, default: 0
- end
-end
diff --git a/db/migrate/20190422032141_migrate_homework_late_time.rb b/db/migrate/20190422032141_migrate_homework_late_time.rb
deleted file mode 100644
index 342986b9c..000000000
--- a/db/migrate/20190422032141_migrate_homework_late_time.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class MigrateHomeworkLateTime < ActiveRecord::Migration[5.2]
- def change
- homeworks = HomeworkCommon.where.not(end_time: nil).where(homework_type: [1, 3 ,4], allow_late: 1, late_time: nil)
- homeworks.each do |homework|
- if homework.course.try(:end_date).present?
- homework.update_column("late_time", homework.course.end_date)
- elsif homework.end_time.present?
- homework.update_column("late_time", Time.at(homework.end_time.to_i + 30*24*3600))
- end
- end
-
- tasks = GraduationTask.where.not(end_time: nil).where(allow_late: 1, late_time: nil)
- tasks.each do |task|
- if task.course.try(:end_date).present?
- task.update_column("late_time", task.course.end_date)
- elsif task.end_time.present?
- task.update_column("late_time", Time.at(task.end_time.to_i + 30*24*3600))
- end
- end
- end
-end
diff --git a/db/migrate/20190422083020_add_journals_for_messages_count_for_hm_and_gt_and_gw.rb b/db/migrate/20190422083020_add_journals_for_messages_count_for_hm_and_gt_and_gw.rb
deleted file mode 100644
index 37162c850..000000000
--- a/db/migrate/20190422083020_add_journals_for_messages_count_for_hm_and_gt_and_gw.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddJournalsForMessagesCountForHmAndGtAndGw < ActiveRecord::Migration[5.2]
- def change
- #add_column :homework_commons, :journals_for_messages_count, :integer, :default => 0
- #add_column :graduation_tasks, :journals_for_messages_count, :integer, :default => 0
- #add_column :graduation_topics, :journals_for_messages_count, :integer, :default => 0
-
- type = ["GraduationTopic", "GraduationTask", "HomeworkCommon"]
- messages = JournalsForMessage.where(jour_type: type).where("m_parent_id is not null")
- # 迁移所有2级以上的回复
- messages.each do |message|
- while message.parent.try(:m_parent_id).present? do
- puts "parent: #{message.parent.try(:m_parent_id)}"
- message.update_attribute(:m_parent_id, message.parent.m_parent_id)
- end
- end
-
- end
-end
diff --git a/db/migrate/20190424014128_migrate_homework_anonymous_comment.rb b/db/migrate/20190424014128_migrate_homework_anonymous_comment.rb
deleted file mode 100644
index 21c20fcce..000000000
--- a/db/migrate/20190424014128_migrate_homework_anonymous_comment.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class MigrateHomeworkAnonymousComment < ActiveRecord::Migration[5.2]
- def change
- change_column_default :homework_commons, :anonymous_comment, from: 1, to: 0
-
- HomeworkCommon.update_all("anonymous_comment = !anonymous_comment")
- end
-end
diff --git a/db/migrate/20190426010412_add_is_invalid_to_student_works_scores.rb b/db/migrate/20190426010412_add_is_invalid_to_student_works_scores.rb
deleted file mode 100644
index 2d782f924..000000000
--- a/db/migrate/20190426010412_add_is_invalid_to_student_works_scores.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-class AddIsInvalidToStudentWorksScores < ActiveRecord::Migration[5.2]
- def change
- add_column :student_works_scores, :is_invalid, :boolean, default: false
-
- StudentWorksScore.where("score is not null").order("id desc").find_each do |score|
- unless score.is_invalid
- if score.student_work.present?
- puts score.id
- work = score.student_work
-
- # 如果分数是调整分 则之前的所有分都无效
- if score.is_ultimate
- work.student_works_scores.where("score is not null and id < #{score.id}").update_all(is_invalid: 1)
-
- # 如果是同一个用户角色的重复评分,则之前的评分都无效
- elsif work.student_works_scores.where("user_id = #{score.user_id} and reviewer_role = #{score.reviewer_role}
- and score is not null and id < #{score.id}").count > 0
- work.student_works_scores.where("user_id = #{score.user_id} and reviewer_role = #{score.reviewer_role}
- and score is not null and id < #{score.id}").update_all(is_invalid: 1)
- end
- end
- end
- end
- end
-end
diff --git a/db/migrate/20190427010940_change_exercise_score_to_float.rb b/db/migrate/20190427010940_change_exercise_score_to_float.rb
deleted file mode 100644
index e8c57bc1e..000000000
--- a/db/migrate/20190427010940_change_exercise_score_to_float.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class ChangeExerciseScoreToFloat < ActiveRecord::Migration[5.2]
- def up
- change_column :exercise_users,:score,:decimal,precision: 10, scale: 1
- change_column :exercise_users, :objective_score, :decimal,precision: 10, scale: 1,default: 0.0
- # change_column :exercise_users, :subjective_score, :decimal,precision: 10, scale: 1,default: 0.0
- change_column :exercise_users, :subjective_score, :decimal,precision: 10, scale: 1,default: -1.0
- # change_column :exercise_answers,:score,:decimal,precision: 10, scale: 1,default: 0.0
- change_column :exercise_answers,:score,:decimal,precision: 10, scale: 1,default: -1.0 #6.10修改,方便判断主观题是否批阅
- change_column :exercise_bank_questions,:question_score,:decimal,precision: 10, scale: 1
- change_column :exercise_bank_shixun_challenges,:question_score,:decimal,precision: 10, scale: 1
- change_column :exercise_questions,:question_score,:decimal,precision: 10, scale: 1
- change_column :exercise_shixun_answers,:score,:decimal,precision: 10, scale: 1
- change_column :exercise_shixun_challenges,:question_score,:decimal,precision: 10, scale: 1
- change_column :exercise_answer_comments, :score,:decimal,precision: 10, scale: 1
- end
-
- def down
- change_column :exercise_users,:score,:integer
- change_column :exercise_users, :objective_score, :integer,default: -1
- change_column :exercise_users, :subjective_score, :integer,default: -1
- change_column :exercise_answers,:score,:integer,default: -1
- change_column :exercise_bank_questions,:question_score,:integer
- change_column :exercise_shixun_answers,:score,:integer
- change_column :exercise_bank_shixun_challenges,:question_score,:integer
- change_column :exercise_questions,:question_score,:integer
- change_column :exercise_shixun_challenges,:question_score,:integer
- change_column :exercise_answer_comments, :score,:integer
- end
-end
diff --git a/db/migrate/20190427045904_update_exercise_default_value.rb b/db/migrate/20190427045904_update_exercise_default_value.rb
deleted file mode 100644
index 05d76ee44..000000000
--- a/db/migrate/20190427045904_update_exercise_default_value.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class UpdateExerciseDefaultValue < ActiveRecord::Migration[5.2]
- def change
- ExerciseUser.where(objective_score: -1.0).update_all(objective_score: 0.0)
- # ExerciseUser.where(subjective_score: -1.0).update_all(subjective_score: 0.0) #主观题默认分数为-1,不需修改
- # ExerciseAnswer.where(score: -1.0).update_all(score: 0.0) #6.10 修改,方便判断主观题是否
- end
-end
diff --git a/db/migrate/20190429012219_change_digest_to_string_in_attachment_histories.rb b/db/migrate/20190429012219_change_digest_to_string_in_attachment_histories.rb
deleted file mode 100644
index d7c7e5b14..000000000
--- a/db/migrate/20190429012219_change_digest_to_string_in_attachment_histories.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ChangeDigestToStringInAttachmentHistories < ActiveRecord::Migration[5.2]
- def change
- change_column :attachment_histories, :digest, :string, :limit => 60
- end
-end
diff --git a/db/migrate/20190429015510_add_default_for_exercises.rb b/db/migrate/20190429015510_add_default_for_exercises.rb
deleted file mode 100644
index 3ebbf6e2f..000000000
--- a/db/migrate/20190429015510_add_default_for_exercises.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddDefaultForExercises < ActiveRecord::Migration[5.2]
- def change
- change_column :exercises, :exercise_status, :integer, :default => 1
- change_column :exercises, :show_result, :integer, :default => 1
- change_column :exercises, :time, :integer, :default => -1
- end
-end
diff --git a/db/migrate/20190429080104_add_quotes_for_graduation_topics.rb b/db/migrate/20190429080104_add_quotes_for_graduation_topics.rb
deleted file mode 100644
index 57694008e..000000000
--- a/db/migrate/20190429080104_add_quotes_for_graduation_topics.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddQuotesForGraduationTopics < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_topics, :quotes, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190430090659_add_default_for_polls.rb b/db/migrate/20190430090659_add_default_for_polls.rb
deleted file mode 100644
index 2fcb260ab..000000000
--- a/db/migrate/20190430090659_add_default_for_polls.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddDefaultForPolls < ActiveRecord::Migration[5.2]
- def change
- change_column :polls, :polls_status, :integer, :default => 1
- end
-end
diff --git a/db/migrate/20190505031946_sync_users_index.rb b/db/migrate/20190505031946_sync_users_index.rb
deleted file mode 100644
index a1f9b40fb..000000000
--- a/db/migrate/20190505031946_sync_users_index.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class SyncUsersIndex < ActiveRecord::Migration[5.2]
- def change
- remove_index :users, name: :index_users_on_phone_and_mail
- remove_index :users, name: :index_users_on_id_and_type
- remove_index :users, name: :index_users_on_auth_source_id
- remove_index :users, name: :index_users_on_type
- end
-end
diff --git a/db/migrate/20190505072404_remove_index_from_users.rb b/db/migrate/20190505072404_remove_index_from_users.rb
deleted file mode 100644
index b19219346..000000000
--- a/db/migrate/20190505072404_remove_index_from_users.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class RemoveIndexFromUsers < ActiveRecord::Migration[5.2]
- def change
- remove_index :users, name: :index_users_on_experience
- end
-end
diff --git a/db/migrate/20190505093440_init_use_index.rb b/db/migrate/20190505093440_init_use_index.rb
deleted file mode 100644
index b7c3101dd..000000000
--- a/db/migrate/20190505093440_init_use_index.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class InitUseIndex < ActiveRecord::Migration[5.2]
- def change
- remove_index :users, name: :index_users_on_login if index_exists?(:users, :login, name: :index_users_on_login)
- remove_index :users, name: :index_users_on_mail if index_exists?(:users, :mail, name: :index_users_on_mail)
- # add_index :users, :login, unique: true
- # add_index :users, :mail, unique: true
- # add_index :users, :phone, unique: true
- end
-end
diff --git a/db/migrate/20190505095131_add_authentication_and_professional_certification_to_courses.rb b/db/migrate/20190505095131_add_authentication_and_professional_certification_to_courses.rb
deleted file mode 100644
index 2cc1ba940..000000000
--- a/db/migrate/20190505095131_add_authentication_and_professional_certification_to_courses.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddAuthenticationAndProfessionalCertificationToCourses < ActiveRecord::Migration[5.2]
- def change
- add_column :courses, :authentication, :boolean, default: false
- add_column :courses, :professional_certification, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190508090916_migrate_new_student_work_status.rb b/db/migrate/20190508090916_migrate_new_student_work_status.rb
deleted file mode 100644
index d2e9bb379..000000000
--- a/db/migrate/20190508090916_migrate_new_student_work_status.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class MigrateNewStudentWorkStatus < ActiveRecord::Migration[5.2]
- def change
- homeworks = HomeworkCommon.where(allow_late: 0)
- StudentWork.where(homework_common_id: homeworks, work_status: 2).update_all(work_status: 1)
- end
-end
diff --git a/db/migrate/20190511020736_add_is_public_to_messages.rb b/db/migrate/20190511020736_add_is_public_to_messages.rb
deleted file mode 100644
index bbbba8f50..000000000
--- a/db/migrate/20190511020736_add_is_public_to_messages.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIsPublicToMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :messages, :is_public, :boolean, :default => false
- end
-end
diff --git a/db/migrate/20190514023907_add_column_to_zip_packs.rb b/db/migrate/20190514023907_add_column_to_zip_packs.rb
deleted file mode 100644
index 8ba250f37..000000000
--- a/db/migrate/20190514023907_add_column_to_zip_packs.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddColumnToZipPacks < ActiveRecord::Migration[5.2]
- def change
- add_column :zip_packs, :container_id, :integer, default: 0
- add_column :zip_packs, :container_type, :string
-
- add_index :zip_packs, [:container_id, :container_type]
-
- ZipPack.all.update_all("container_type='HomeworkCommon', container_id = homework_id")
- end
-end
diff --git a/db/migrate/20190514083047_change_question_random_exercises.rb b/db/migrate/20190514083047_change_question_random_exercises.rb
deleted file mode 100644
index 313d648bb..000000000
--- a/db/migrate/20190514083047_change_question_random_exercises.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class ChangeQuestionRandomExercises < ActiveRecord::Migration[5.2]
- def up
- change_column :exercises,:question_random,:boolean,default: false
- change_column :exercises,:choice_random,:boolean,default: false
-
- end
- def down
- change_column :exercises,:question_random,:integer,default: 0
- change_column :exercises,:choice_random,:integer,default: 0
- end
-end
diff --git a/db/migrate/20190515014734_change_poll_show_result_boolean.rb b/db/migrate/20190515014734_change_poll_show_result_boolean.rb
deleted file mode 100644
index f74dd02c4..000000000
--- a/db/migrate/20190515014734_change_poll_show_result_boolean.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class ChangePollShowResultBoolean < ActiveRecord::Migration[5.2]
- def change
- def up
- change_column :polls,:show_result,:boolean,default: true
- end
- def down
- change_column :polls,:show_result,:integer,default: 1
- end
- end
-end
diff --git a/db/migrate/20190517080313_add_test_set_average_for_challenges.rb b/db/migrate/20190517080313_add_test_set_average_for_challenges.rb
deleted file mode 100644
index cac1d80bc..000000000
--- a/db/migrate/20190517080313_add_test_set_average_for_challenges.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddTestSetAverageForChallenges < ActiveRecord::Migration[5.2]
- def change
- add_column :challenges, :test_set_average, :boolean, :default => true
- end
-end
diff --git a/db/migrate/20190517085407_create_edu_settings.rb b/db/migrate/20190517085407_create_edu_settings.rb
deleted file mode 100644
index e6c081233..000000000
--- a/db/migrate/20190517085407_create_edu_settings.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateEduSettings < ActiveRecord::Migration[5.2]
- def change
- create_table :edu_settings do |t|
- t.string :name
- t.string :value
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190517092730_add_description_to_edu_settings.rb b/db/migrate/20190517092730_add_description_to_edu_settings.rb
deleted file mode 100644
index ad273b805..000000000
--- a/db/migrate/20190517092730_add_description_to_edu_settings.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class AddDescriptionToEduSettings < ActiveRecord::Migration[5.2]
- def change
- add_column :edu_settings, :description, :string
- add_index :edu_settings, :name, unique: :true
-
- ['tomcat_webssh', 'webssh_username', 'webssh_password', 'git_address_ip', 'git_address_domain', 'git_username',
- 'git_password', 'public_key', 'private_key', 'public_bucket', 'public_bucket_host', 'public_cdn_host', 'cloud_bridge',
- 'cloud_tomcat_php', 'host_name', 'old_edu_host'].each do |name|
- if EduSetting.find_by_name(name).nil?
- EduSetting.create(name: name)
- end
- end
- end
-end
diff --git a/db/migrate/20190518085626_add_index_to_verificatiojn_codes.rb b/db/migrate/20190518085626_add_index_to_verificatiojn_codes.rb
deleted file mode 100644
index e4bdaac19..000000000
--- a/db/migrate/20190518085626_add_index_to_verificatiojn_codes.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddIndexToVerificatiojnCodes < ActiveRecord::Migration[5.2]
- def change
- add_index :verification_codes, [:phone], name: 'by_phone' if !index_exists?(:verification_codes, :phone)
- add_index :verification_codes, [:email], name: 'by_email' if !index_exists?(:verification_codes, :email)
- end
-end
diff --git a/db/migrate/20190522091226_alter_educoder_indexs.rb b/db/migrate/20190522091226_alter_educoder_indexs.rb
deleted file mode 100644
index 6e1ed9bb5..000000000
--- a/db/migrate/20190522091226_alter_educoder_indexs.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-class AlterEducoderIndexs < ActiveRecord::Migration[5.2]
- def change
-
- add_index :onclick_times, :user_id if !index_exists?(:onclick_times, :user_id)
- remove_index :courses, :syllabus_id
- add_index :courses, :tea_id
- add_index :course_modules, [:course_id, :module_type]
- remove_index :homework_commons, :course_homework_category_id
- add_index :exercises, :course_id
- remove_index :teacher_course_groups, :member_id
- remove_index :student_works, :created_at
- remove_index :student_works, :user_id
- remove_index :student_works, :myshixun_id
- remove_index :homework_challenge_settings, :shixun_id
- remove_index :exercise_users, :exercise_id
- add_index :exercise_users, [:exercise_id, :user_id]
- add_index :homework_banks, :user_id
- remove_index :exercise_answers, :exercise_choice_id
- remove_index :exercise_answers, :exercise_question_id
- add_index :exercise_answers, [:exercise_question_id, :user_id]
- remove_index :exercise_shixun_challenges, :shixun_id
- remove_index :exercise_shixun_answers, :exercise_shixun_challenge_id
- remove_index :exercise_shixun_answers, :exercise_question_id
- add_index :exercise_shixun_answers, [:exercise_question_id, :user_id], name: "exercise_question_id_user_id"
- remove_index :student_works_evaluation_distributions, :student_work_id
- add_index :student_works_evaluation_distributions, :user_id
- remove_index :challenge_work_scores, :user_id
- add_index :poll_questions, :poll_id
- add_index :poll_users, [:poll_id, :user_id]
- add_index :poll_answers, :poll_question_id
- add_index :poll_votes, [:poll_question_id, :user_id], name: "poll_question_id_user_id"
- remove_index :graduation_tasks, :user_id
- remove_index :graduation_work_comment_assignations, :graduation_group_id
- remove_index :graduation_works, :course_id
- remove_index :graduation_works, :project_id
- remove_index :graduation_works, :graduation_task_id
- remove_index :graduation_works, :user_id
- add_index :graduation_works, [:graduation_task_id, :user_id], name: "graduation_task_id_user_id"
-
- remove_index :graduation_work_scores, :graduation_task_id
- remove_index :graduation_topics, :user_id
- remove_index :graduation_topics, :tea_id
- remove_index :student_graduation_topics, :member_id
- remove_index :student_graduation_topics, :course_member_id
- add_index :boards, :course_id
- remove_index :messages, :author_id
- remove_index :messages, :is_hidden
- remove_index :messages, :root_id
- remove_index :messages, :created_on
- remove_index :attachments, :quotes
- remove_index :attachments, :is_public
- remove_index :attachments, :course_second_category_id
- remove_index :course_members, :graduation_group_id
- add_index :student_works_scores_appeals, :student_works_score_id
- add_index :challenges, :shixun_id
- add_index :challenge_chooses, :challenge_id
- add_index :challenge_questions, :challenge_choose_id
- add_index :challenge_tags, :challenge_id
- remove_index :games, :user_id
- add_index :shixun_members, :shixun_id
- add_index :shixun_tag_repertoires, [:shixun_id, :tag_repertoire_id], name: "shixun_id_tag_repertoire_id"
- add_index :shixun_schools, :shixun_id
- add_index :shixun_mirror_repositories, :shixun_id
- add_index :shixun_modifies, [:shixun_id, :myshixun_id], name: "shixun_id_myshixun_id"
- remove_index :myshixuns, :user_id
- remove_index :outputs, :created_at
- remove_index :outputs, :test_set_position
- remove_index :stages, :user_id
- end
-end
diff --git a/db/migrate/20190524020819_change_exercise_question_type.rb b/db/migrate/20190524020819_change_exercise_question_type.rb
deleted file mode 100644
index 625a57d06..000000000
--- a/db/migrate/20190524020819_change_exercise_question_type.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class ChangeExerciseQuestionType < ActiveRecord::Migration[5.2]
- def change
- ExerciseQuestion.where(question_type: 1).update_all(question_type: 0) #新版0为单选题,1为多选题,2为判断题
- ExerciseQuestion.where(question_type: 2).update_all(question_type: 1)
-
- ExerciseBankQuestion.where(question_type: 1).update_all(question_type: 0)
- ExerciseBankQuestion.where(question_type: 2).update_all(question_type: 1)
-
- end
-end
diff --git a/db/migrate/20190528024055_migrate_base_on_project.rb b/db/migrate/20190528024055_migrate_base_on_project.rb
deleted file mode 100644
index d0ee197cb..000000000
--- a/db/migrate/20190528024055_migrate_base_on_project.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateBaseOnProject < ActiveRecord::Migration[5.2]
- def change
- change_column :homework_detail_groups, :base_on_project, :boolean, default: true
- end
-end
diff --git a/db/migrate/20190603024856_migrate_course_late_settings.rb b/db/migrate/20190603024856_migrate_course_late_settings.rb
deleted file mode 100644
index 3097d3d34..000000000
--- a/db/migrate/20190603024856_migrate_course_late_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class MigrateCourseLateSettings < ActiveRecord::Migration[5.2]
- def change
- change_column_default :homework_commons, :allow_late, from: 1, to: 0
- change_column_default :homework_commons, :late_penalty, from: 5, to: 0
-
- change_column_default :graduation_tasks, :allow_late, from: 1, to: 0
- change_column_default :graduation_tasks, :late_penalty, from: 5, to: 0
- end
-end
diff --git a/db/migrate/20190606061948_migrate_student_works_scores_score.rb b/db/migrate/20190606061948_migrate_student_works_scores_score.rb
deleted file mode 100644
index c531357a8..000000000
--- a/db/migrate/20190606061948_migrate_student_works_scores_score.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateStudentWorksScoresScore < ActiveRecord::Migration[5.2]
- def change
- change_column :student_works_scores, :score, :float
- end
-end
diff --git a/db/migrate/20190610013620_change_question_random_default_true.rb b/db/migrate/20190610013620_change_question_random_default_true.rb
deleted file mode 100644
index d0c785d46..000000000
--- a/db/migrate/20190610013620_change_question_random_default_true.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class ChangeQuestionRandomDefaultTrue < ActiveRecord::Migration[5.2]
- #试卷的题目和选项的随机显示,需默认勾选
- def up
- change_column_default :exercises,:question_random,true
- change_column_default :exercises,:choice_random,true
- end
-
- def down
- change_column_default :exercises,:question_random,false
- change_column_default :exercises,:choice_random,false
- end
-end
diff --git a/db/migrate/20190613022158_add_exec_time_to_challenge.rb b/db/migrate/20190613022158_add_exec_time_to_challenge.rb
deleted file mode 100644
index c1743674c..000000000
--- a/db/migrate/20190613022158_add_exec_time_to_challenge.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddExecTimeToChallenge < ActiveRecord::Migration[5.2]
- def change
- add_column :challenges, :exec_time, :integer
-
- Shixun.find_each do |shixun|
- shixun.challenges.update_all(exec_time: shixun.exec_time)
- end
- end
-end
diff --git a/db/migrate/20190617081105_change_default_data_for_name_in_borads.rb b/db/migrate/20190617081105_change_default_data_for_name_in_borads.rb
deleted file mode 100644
index 2dbbb7146..000000000
--- a/db/migrate/20190617081105_change_default_data_for_name_in_borads.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class ChangeDefaultDataForNameInBorads < ActiveRecord::Migration[5.2]
- def change
- puts "--------- START ------------"
- Board.roots.joins(:course).where('courses.id = boards.course_id').find_each do |board|
- board.update_columns(name: '讨论区') unless board.name.strip === '讨论区'
- puts "Board ID IS #{board.id}"
- end
- puts "--------- END ----------"
- end
-end
diff --git a/db/migrate/20190619055012_add_uniq_index_to_course_modules.rb b/db/migrate/20190619055012_add_uniq_index_to_course_modules.rb
deleted file mode 100644
index 92ae6449f..000000000
--- a/db/migrate/20190619055012_add_uniq_index_to_course_modules.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-class AddUniqIndexToCourseModules < ActiveRecord::Migration[5.2]
- def change
- # sql = %Q(delete from exercise_users where (user_id, exercise_id) in
- # (select * from (select user_id, exercise_id from exercise_users group by user_id, exercise_id having count(*) > 1) a)
- # and id not in (select * from (select min(id) from exercise_users group by user_id, exercise_id having count(*) > 1 order by id) b))
- # ActiveRecord::Base.connection.execute sql
- #
- # add_index :exercise_users, [:user_id, :exercise_id], unique: true, name: "index_user_id_and_exercise_id"
-
-
- sql = %Q(delete from exercise_shixun_answers where (user_id, exercise_shixun_challenge_id) in
- (select * from (select user_id, exercise_shixun_challenge_id from exercise_shixun_answers group by user_id, exercise_shixun_challenge_id having count(*) > 1) a)
- and id not in (select * from (select min(id) from exercise_shixun_answers group by user_id, exercise_shixun_challenge_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
-
- add_index :exercise_shixun_answers, [:user_id, :exercise_shixun_challenge_id], unique: true,
- name: "index_user_id_and_exercise_shixun_challenge_id"
-
-
- # sql = %Q(delete from student_works where (user_id, homework_common_id) in
- # (select * from (select user_id, homework_common_id from student_works group by user_id, homework_common_id having count(*) > 1) a)
- # and id not in (select * from (select min(id) from student_works group by user_id, homework_common_id having count(*) > 1 order by id) b))
- # ActiveRecord::Base.connection.execute sql
- #
- # add_index :student_works, [:user_id, :homework_common_id], unique: true, name: "index_user_id_and_homework_common_id"
- #
- #
- # sql = %Q(delete from poll_users where (user_id, poll_id) in
- # (select * from (select user_id, poll_id from poll_users group by user_id, poll_id having count(*) > 1) a) and
- # id not in (select * from (select min(id) from poll_users group by user_id, poll_id having count(*) > 1 order by id) b))
- # ActiveRecord::Base.connection.execute sql
- #
- # add_index :poll_users, [:user_id, :poll_id], unique: true, name: "index_user_id_and_poll_id"
- #
- #
- # sql = %Q(delete from graduation_works where (user_id, graduation_task_id) in
- # (select * from (select user_id, graduation_task_id from graduation_works group by user_id, graduation_task_id having count(*) > 1) a) and
- # id not in (select * from (select min(id) from graduation_works group by user_id, graduation_task_id having count(*) > 1 order by id) b))
- # ActiveRecord::Base.connection.execute sql
- #
- # add_index :graduation_works, [:user_id, :graduation_task_id], unique: true, name: "index_user_id_and_graduation_task_id"
- end
-end
diff --git a/db/migrate/20190619093200_add_profile_completed_to_users.rb b/db/migrate/20190619093200_add_profile_completed_to_users.rb
deleted file mode 100644
index 5248abd58..000000000
--- a/db/migrate/20190619093200_add_profile_completed_to_users.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddProfileCompletedToUsers < ActiveRecord::Migration[5.2]
- def change
- add_column :users, :profile_completed, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190619120609_add_graduation_topics_count_to_course.rb b/db/migrate/20190619120609_add_graduation_topics_count_to_course.rb
deleted file mode 100644
index 01444b7ce..000000000
--- a/db/migrate/20190619120609_add_graduation_topics_count_to_course.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddGraduationTopicsCountToCourse < ActiveRecord::Migration[5.2]
- def change
- add_column :courses, :graduation_topics_count, :integer, :default => 0
- add_column :courses, :graduation_tasks_count, :integer, :default => 0
- # add_column :courses, :attachments_count, :integer, :default => 0
- add_column :courses, :polls_count, :integer, :default => 0
- add_column :courses, :exercises_count, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190619123328_sync_countcha_for_course.rb b/db/migrate/20190619123328_sync_countcha_for_course.rb
deleted file mode 100644
index acd9e9716..000000000
--- a/db/migrate/20190619123328_sync_countcha_for_course.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class SyncCountchaForCourse < ActiveRecord::Migration[5.2]
- def change
- Course.find_each do |course|
- Course.reset_counters course.id, :graduation_topics
- Course.reset_counters course.id, :graduation_tasks
- Course.reset_counters course.id, :polls
- Course.reset_counters course.id, :exercises
- # Course.reset_counters course.id, :attachments
- end
- end
-end
diff --git a/db/migrate/20190620010439_add_uniq_index_to_course_member.rb b/db/migrate/20190620010439_add_uniq_index_to_course_member.rb
deleted file mode 100644
index f17cd4274..000000000
--- a/db/migrate/20190620010439_add_uniq_index_to_course_member.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddUniqIndexToCourseMember < ActiveRecord::Migration[5.2]
- def change
- # sql = %Q(delete from course_members where (user_id, course_id, role) in
- # (select * from (select user_id, course_id, role from course_members group by user_id, course_id, role having count(*) > 1) a)
- # and id not in (select * from (select min(id) from course_members group by user_id, course_id, role having count(*) > 1 order by id) b))
- # ActiveRecord::Base.connection.execute sql
- #
- # add_index :course_members, [:user_id, :course_id, :role], unique: true, name: "index_user_id_course_id_role"
- end
-end
diff --git a/db/migrate/20190620015912_modify_colla_index.rb b/db/migrate/20190620015912_modify_colla_index.rb
deleted file mode 100644
index 0e9e23301..000000000
--- a/db/migrate/20190620015912_modify_colla_index.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-class ModifyCollaIndex < ActiveRecord::Migration[5.2]
- def change
- remove_index :exercise_users, [:user_id, :exercise_id] if index_exists?(:exercise_users, [:user_id, :exercise_id])
- remove_index :exercise_users, [:exercise_id, :user_id] if index_exists?(:exercise_users, [:exercise_id, :user_id])
- sql = %Q(delete from exercise_users where (user_id, exercise_id) in
- (select * from (select user_id, exercise_id from exercise_users group by user_id, exercise_id having count(*) > 1) a)
- and id not in (select * from (select min(id) from exercise_users group by user_id, exercise_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :exercise_users, [:exercise_id, :user_id], unique: true, name: "index_on_exercise_id_user_id"
-
-
- remove_index :exercise_shixun_answers, :user_id
-
-
- remove_index :student_works, [:user_id, :homework_common_id] if index_exists?(:student_works, [:user_id, :homework_common_id])
- remove_index :student_works, [:homework_common_id, :user_id] if index_exists?(:student_works, [:homework_common_id, :user_id])
- sql = %Q(delete from student_works where (user_id, homework_common_id) in
- (select * from (select user_id, homework_common_id from student_works group by user_id, homework_common_id having count(*) > 1) a)
- and id not in (select * from (select min(id) from student_works group by user_id, homework_common_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :student_works, [:homework_common_id, :user_id], unique: true, name: "index_on_homework_common_id_user_id"
-
-
- remove_index :poll_users, [:user_id, :poll_id] if index_exists?(:poll_users, [:user_id, :poll_id])
- remove_index :poll_users, [:poll_id, :user_id] if index_exists?(:poll_users, [:poll_id, :user_id])
- sql = %Q(delete from poll_users where (user_id, poll_id) in
- (select * from (select user_id, poll_id from poll_users group by user_id, poll_id having count(*) > 1) a) and
- id not in (select * from (select min(id) from poll_users group by user_id, poll_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :poll_users, [:poll_id, :user_id], unique: true, name: "index_poll_id_and_user_id"
-
-
- remove_index :graduation_works, [:user_id, :graduation_task_id] if index_exists?(:graduation_works, [:user_id, :graduation_task_id])
- remove_index :graduation_works, [:graduation_task_id, :user_id] if index_exists?(:graduation_works, [:graduation_task_id, :user_id])
- sql = %Q(delete from graduation_works where (user_id, graduation_task_id) in
- (select * from (select user_id, graduation_task_id from graduation_works group by user_id, graduation_task_id having count(*) > 1) a) and
- id not in (select * from (select min(id) from graduation_works group by user_id, graduation_task_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :graduation_works, [:graduation_task_id, :user_id], unique: true, name: "index_graduation_task_id_and_user_id"
-
-
- remove_index :course_members, [:user_id, :course_id, :role] if index_exists?(:course_members, [:user_id, :course_id, :role])
- remove_index :course_members, :course_id if index_exists?(:course_members, :course_id)
- remove_index :course_members, :user_id if index_exists?(:course_members, :user_id)
- sql = %Q(delete from course_members where (course_id, user_id, role) in
- (select * from (select course_id, user_id, role from course_members group by course_id, user_id, role having count(*) > 1) a)
- and id not in (select * from (select min(id) from course_members group by course_id, user_id, role having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :course_members, [:course_id, :user_id, :role], unique: true, name: "index_course_id_user_id_role"
- end
-end
diff --git a/db/migrate/20190620021243_add_homework_bank_id_index_to_homework_commons.rb b/db/migrate/20190620021243_add_homework_bank_id_index_to_homework_commons.rb
deleted file mode 100644
index 9a97b82bf..000000000
--- a/db/migrate/20190620021243_add_homework_bank_id_index_to_homework_commons.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddHomeworkBankIdIndexToHomeworkCommons < ActiveRecord::Migration[5.2]
- def change
- add_index :homework_commons, :homework_bank_id
- end
-end
diff --git a/db/migrate/20190620075503_add_bank_id_for_graduation_task_and_topic.rb b/db/migrate/20190620075503_add_bank_id_for_graduation_task_and_topic.rb
deleted file mode 100644
index 8149731e7..000000000
--- a/db/migrate/20190620075503_add_bank_id_for_graduation_task_and_topic.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddBankIdForGraduationTaskAndTopic < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_tasks, :gtask_bank_id, :integer
- add_column :graduation_topics, :gtopic_bank_id, :integer
- end
-end
diff --git a/db/migrate/20190621010002_change_default_to_max_num.rb b/db/migrate/20190621010002_change_default_to_max_num.rb
deleted file mode 100644
index 435756cd8..000000000
--- a/db/migrate/20190621010002_change_default_to_max_num.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ChangeDefaultToMaxNum < ActiveRecord::Migration[5.2]
- def change
- change_column :graduation_tasks, :max_num, :integer, default: 5
- end
-end
diff --git a/db/migrate/20190621062948_migrate_course_module_activity.rb b/db/migrate/20190621062948_migrate_course_module_activity.rb
deleted file mode 100644
index 1fa1ea112..000000000
--- a/db/migrate/20190621062948_migrate_course_module_activity.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateCourseModuleActivity < ActiveRecord::Migration[5.2]
- def change
- CourseModule.where(module_type: 'activity').update_all(hidden: 1)
- end
-end
\ No newline at end of file
diff --git a/db/migrate/20190621083604_add_descendants_count_to_messages.rb b/db/migrate/20190621083604_add_descendants_count_to_messages.rb
deleted file mode 100644
index 02b721583..000000000
--- a/db/migrate/20190621083604_add_descendants_count_to_messages.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddDescendantsCountToMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :messages, :descendants_count, :integer, default: 0
- end
-end
diff --git a/db/migrate/20190621105144_sync_ivalid_users.rb b/db/migrate/20190621105144_sync_ivalid_users.rb
deleted file mode 100644
index f2875977f..000000000
--- a/db/migrate/20190621105144_sync_ivalid_users.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-class SyncIvalidUsers < ActiveRecord::Migration[5.2]
- # def change
- # users = User.where.not(id: 2).find_by_sql("select count(*) as user_count, login from users group by login having user_count>1")
- # users.each do |user|
- # valid_users = User.where(login: user.login)
- # valid_users.each do |valid_user|
- # unless valid_user.lastname.present?
- # valid_user.delete
- # end
- # end
- # end
- #
- # mail_users = User.where.not(id: 2).find_by_sql("select count(*) as user_count, mail from users where mail is not null group by mail having user_count>1")
- # mail_users.each do |mail_user|
- # valid_mail_users = User.where(mail: mail_user.mail)
- # valid_mail_users.each do |valid_mail_user|
- # unless valid_mail_user.lastname.present?
- # valid_mail_user.delete
- # end
- # end
- # end
- #
- #
- # phone_users = User.where.not(id: 2).find_by_sql("select count(*) as user_count, phone from users where phone is not null group by phone having user_count>1")
- # phone_users.each do |phone_user|
- # valid_phone_users = User.where(phone: phone_user.phone)
- # valid_phone_users.each do |valid_phone_user|
- # unless valid_phone_user.lastname.present?
- # valid_phone_user.delete
- # end
- # end
- # end
- # end
-end
diff --git a/db/migrate/20190622055449_modify_shixun_info_for_shixuns.rb b/db/migrate/20190622055449_modify_shixun_info_for_shixuns.rb
deleted file mode 100644
index 1a3aa147b..000000000
--- a/db/migrate/20190622055449_modify_shixun_info_for_shixuns.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class ModifyShixunInfoForShixuns < ActiveRecord::Migration[5.2]
- def change
- Shixun.find_each do |shixun|
- if shixun.shixun_info
- shixun.shixun_info.update_attributes(propaedeutics: shixun[:propaedeutics],
- description: shixun[:description],
- evaluate_script: shixun[:evaluate_script],
- shixun_id: shixun[:id])
- else
- ShixunInfo.create!(propaedeutics: shixun[:propaedeutics], description: shixun[:description],
- evaluate_script: shixun[:evaluate_script], shixun_id: shixun.id)
- end
- end
- end
-end
diff --git a/db/migrate/20190622060005_remove_shixun_long_text_for_shixuns.rb b/db/migrate/20190622060005_remove_shixun_long_text_for_shixuns.rb
deleted file mode 100644
index 4557c610f..000000000
--- a/db/migrate/20190622060005_remove_shixun_long_text_for_shixuns.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class RemoveShixunLongTextForShixuns < ActiveRecord::Migration[5.2]
- def change
- if Shixun.first.has_attribute?(:description)
- remove_columns :shixuns, :description, :propaedeutics, :evaluate_script
- end
- end
-end
diff --git a/db/migrate/20190624085120_add_uniq_index_to_homework_challenge_settings.rb b/db/migrate/20190624085120_add_uniq_index_to_homework_challenge_settings.rb
deleted file mode 100644
index 49a385ad9..000000000
--- a/db/migrate/20190624085120_add_uniq_index_to_homework_challenge_settings.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddUniqIndexToHomeworkChallengeSettings < ActiveRecord::Migration[5.2]
- def change
- remove_index :homework_challenge_settings, [:homework_common_id, :challenge_id] if index_exists?(:homework_challenge_settings, [:homework_common_id, :challenge_id])
- sql = %Q(delete from homework_challenge_settings where (homework_common_id, challenge_id) in
- (select * from (select homework_common_id, challenge_id from homework_challenge_settings group by homework_common_id, challenge_id having count(*) > 1) a)
- and id not in (select * from (select max(id) from homework_challenge_settings group by homework_common_id, challenge_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :homework_challenge_settings, [:homework_common_id, :challenge_id], unique: true, name: "index_on_homework_common_id_challenge_id"
- end
-end
diff --git a/db/migrate/20190625012548_add_index_for_evaluate_record.rb b/db/migrate/20190625012548_add_index_for_evaluate_record.rb
deleted file mode 100644
index d67e33b1e..000000000
--- a/db/migrate/20190625012548_add_index_for_evaluate_record.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddIndexForEvaluateRecord < ActiveRecord::Migration[5.2]
- def change
- # 增加evalute_records的索引,提高查询效率
- add_index :evaluate_records, :game_id
- end
-end
diff --git a/db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb b/db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb
deleted file mode 100644
index a47157414..000000000
--- a/db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class ModifyQuotesForGtopicBanks < ActiveRecord::Migration[5.2]
- def change
- GtopicBank.where("quotes is null").update_all(:quotes => 0)
- change_column :gtopic_banks, :quotes, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190701013243_add_calculation_time_to_homework.rb b/db/migrate/20190701013243_add_calculation_time_to_homework.rb
deleted file mode 100644
index 4a622ee92..000000000
--- a/db/migrate/20190701013243_add_calculation_time_to_homework.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddCalculationTimeToHomework < ActiveRecord::Migration[5.2]
- def change
- add_column :homework_commons, :calculation_time, :datetime
- add_column :student_works, :calculation_time, :datetime
- end
-end
diff --git a/db/migrate/20190703072611_add_old_exercise_tiankong_choice_id.rb b/db/migrate/20190703072611_add_old_exercise_tiankong_choice_id.rb
deleted file mode 100644
index 9ad1429e2..000000000
--- a/db/migrate/20190703072611_add_old_exercise_tiankong_choice_id.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class AddOldExerciseTiankongChoiceId < ActiveRecord::Migration[5.2]
-
- def up
- #类型为3 的问题答案及标准答案更新exercise_choice_id 为1,即表示第一空
- exercise_question_ids = ExerciseQuestion.where("question_type = 3").pluck(:id)
- ExerciseAnswer.where(exercise_question_id: exercise_question_ids,exercise_choice_id: nil).update_all(exercise_choice_id:1)
- ExerciseStandardAnswer.where(exercise_question_id: exercise_question_ids,exercise_choice_id: nil).update_all(exercise_choice_id:1)
-
- exercise_bank_question_ids = ExerciseBankQuestion.where("question_type =3").pluck(:id)
- ExerciseBankStandardAnswer.where(exercise_bank_question_id: exercise_bank_question_ids).update_all(exercise_bank_choice_id:1)
- end
-
- def down
- #类型为3 的问题答案及标准答案更新exercise_choice_id 为1,即表示第一空
- exercise_question_ids = ExerciseQuestion.where("question_type = 3").pluck(:id)
- ExerciseAnswer.where(exercise_question_id: exercise_question_ids,exercise_choice_id: 1).update_all(exercise_choice_id:nil)
- ExerciseStandardAnswer.where(exercise_question_id: exercise_question_ids,exercise_choice_id: 1).update_all(exercise_choice_id:nil)
-
- exercise_bank_question_ids = ExerciseBankQuestion.where("question_type =3").pluck(:id)
- ExerciseBankStandardAnswer.where(exercise_bank_question_id: exercise_bank_question_ids).update_all(exercise_bank_choice_id:nil)
- end
-
-end
diff --git a/db/migrate/20190703090511_add_index_for_shixun_services.rb b/db/migrate/20190703090511_add_index_for_shixun_services.rb
deleted file mode 100644
index 693add3e3..000000000
--- a/db/migrate/20190703090511_add_index_for_shixun_services.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddIndexForShixunServices < ActiveRecord::Migration[5.2]
- def change
- sql = %Q(delete from shixun_service_configs where (shixun_id, mirror_repository_id) in
- (select * from (select shixun_id, mirror_repository_id from shixun_service_configs group by shixun_id, mirror_repository_id having count(*) > 1) a)
- and id not in (select * from (select min(id) from shixun_service_configs group by shixun_id, mirror_repository_id having count(*) > 1 order by id) b))
- ActiveRecord::Base.connection.execute sql
- add_index :shixun_service_configs, [:shixun_id, :mirror_repository_id], unique: true, name: "shixun_id_mirror_id_unique"
- end
-end
diff --git a/db/migrate/20190705011739_add_praises_count_for_challenges.rb b/db/migrate/20190705011739_add_praises_count_for_challenges.rb
deleted file mode 100644
index 6ae1d8420..000000000
--- a/db/migrate/20190705011739_add_praises_count_for_challenges.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddPraisesCountForChallenges < ActiveRecord::Migration[5.2]
- def change
- add_column :challenges, :praises_count, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190705013204_modify_praises_count_for_challenges.rb b/db/migrate/20190705013204_modify_praises_count_for_challenges.rb
deleted file mode 100644
index 59aa6ca53..000000000
--- a/db/migrate/20190705013204_modify_praises_count_for_challenges.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class ModifyPraisesCountForChallenges < ActiveRecord::Migration[5.2]
- def change
- challenges = Challenge.where(nil).unscoped
- challenges.find_each do |c|
- praises_count = c.praise_treads.where(praise_or_tread: 1).count
- c.update_column(:praises_count, praises_count)
- end
- end
-end
diff --git a/db/migrate/20190705022502_add_praises_count_for_discuess.rb b/db/migrate/20190705022502_add_praises_count_for_discuess.rb
deleted file mode 100644
index 47fd5ec1a..000000000
--- a/db/migrate/20190705022502_add_praises_count_for_discuess.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddPraisesCountForDiscuess < ActiveRecord::Migration[5.2]
- def change
- add_column :discusses, :praises_count, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190705022737_modify_praises_count_for_discuess.rb b/db/migrate/20190705022737_modify_praises_count_for_discuess.rb
deleted file mode 100644
index 4d5b6ca97..000000000
--- a/db/migrate/20190705022737_modify_praises_count_for_discuess.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class ModifyPraisesCountForDiscuess < ActiveRecord::Migration[5.2]
- def change
- discusses = Discuss.includes(:praise_treads).unscoped
- discusses.find_each do |d|
- praises_count = d.praise_treads.liker.count
- d.update_column(:praises_count, praises_count)
- end
- end
-end
diff --git a/db/migrate/20190705085829_add_sec_key_to_outputs.rb b/db/migrate/20190705085829_add_sec_key_to_outputs.rb
deleted file mode 100644
index 1da2930ae..000000000
--- a/db/migrate/20190705085829_add_sec_key_to_outputs.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddSecKeyToOutputs < ActiveRecord::Migration[5.2]
- def change
- #add_column :outputs, :sec_key, :string
- # add_column :outputs, :ts_mem, :float
- # add_column :outputs, :ts_time, :float
- end
-end
diff --git a/db/migrate/20190706010307_create_user_interests.rb b/db/migrate/20190706010307_create_user_interests.rb
deleted file mode 100644
index d64a1c228..000000000
--- a/db/migrate/20190706010307_create_user_interests.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class CreateUserInterests < ActiveRecord::Migration[5.2]
- def change
- create_table :user_interests do |t|
- t.references :user
- t.references :repertoire
- end
- end
-end
diff --git a/db/migrate/20190708062910_add_index_for_run_code_message.rb b/db/migrate/20190708062910_add_index_for_run_code_message.rb
deleted file mode 100644
index 4449d58a2..000000000
--- a/db/migrate/20190708062910_add_index_for_run_code_message.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIndexForRunCodeMessage < ActiveRecord::Migration[5.2]
- def change
- add_index :run_code_messages, :game_id
- end
-end
diff --git a/db/migrate/20190711062033_modify_challenge_id_for_discusses.rb b/db/migrate/20190711062033_modify_challenge_id_for_discusses.rb
deleted file mode 100644
index 86052375b..000000000
--- a/db/migrate/20190711062033_modify_challenge_id_for_discusses.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class ModifyChallengeIdForDiscusses < ActiveRecord::Migration[5.2]
- def change
- discusses = Discuss.where(challenge_id: nil)
- discusses.each do |dis|
- challenge_id = Shixun.find(dis.dis_id).challenges.first.id
- dis.update_column(:challenge_id, challenge_id)
- end
- add_index :discusses, :challenge_id
-
- end
-end
diff --git a/db/migrate/20190713022300_modify_md_attachment_url_for_md_cotents.rb b/db/migrate/20190713022300_modify_md_attachment_url_for_md_cotents.rb
deleted file mode 100644
index 10b821fc5..000000000
--- a/db/migrate/20190713022300_modify_md_attachment_url_for_md_cotents.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-class ModifyMdAttachmentUrlForMdCotents < ActiveRecord::Migration[5.2]
- def change
- # 更新MarkDown图片的URL
- homework_commons = HomeworkCommon.all
- homework_commons.find_each do |hc|
- hc.update_column(:description, hc.description.gsub("![](/attachments/download", "![](/api/attachments")) if hc.description.present?
- end
-
- challenges = Challenge.all.unscoped
- challenges.find_each do |c|
- c.update_column(:task_pass, c.task_pass.gsub("![](/attachments/download", "![](/api/attachments")) if c.task_pass.present?
- end
-
- challenge_answers = ChallengeAnswer.all.unscoped
- challenge_answers.find_each do |ca|
- ca.update_column(:contents, ca.contents.gsub("![](/attachments/download", "![](/api/attachments")) if ca.contents.present?
- end
-
- shixun_infos = ShixunInfo.all
- shixun_infos.find_each do |si|
- si.update_column(:propaedeutics, si.propaedeutics.gsub("![](/attachments/download", "![](/api/attachments")) if si.propaedeutics.present?
- si.update_column(:description, si.description.gsub("![](/attachments/download", "![](/api/attachments")) if si.description.present?
- end
-
- subjects = Subject.all
- subjects.find_each do |s|
- s.update_column(:description, s.description.gsub("![](/attachments/download", "![](/api/attachments")) if s.description.present?
- end
-
- plats = PlatformSample.where(samples_type: ['introduction', 'knowledge'])
- plats.find_each do |p|
- p.update_column(:contents, p.contents.gsub("![](/attachments/download", "![](/api/attachments")) if p.contents.present?
- end
- end
-end
diff --git a/db/migrate/20190716064225_add_max_mem_to_evaluate_records.rb b/db/migrate/20190716064225_add_max_mem_to_evaluate_records.rb
deleted file mode 100644
index 86425262d..000000000
--- a/db/migrate/20190716064225_add_max_mem_to_evaluate_records.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddMaxMemToEvaluateRecords < ActiveRecord::Migration[5.2]
- def change
- #add_column :evaluate_records, :max_mem, :float
- end
-end
diff --git a/db/migrate/20190720025309_add_ts_mem_for_outputs.rb b/db/migrate/20190720025309_add_ts_mem_for_outputs.rb
deleted file mode 100644
index fac886fda..000000000
--- a/db/migrate/20190720025309_add_ts_mem_for_outputs.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddTsMemForOutputs < ActiveRecord::Migration[5.2]
- def change
- #add_column :outputs, :ts_mem, :float
- end
-end
diff --git a/db/migrate/20190720025341_add_ts_time_for_outputs.rb b/db/migrate/20190720025341_add_ts_time_for_outputs.rb
deleted file mode 100644
index 9c5f8a23f..000000000
--- a/db/migrate/20190720025341_add_ts_time_for_outputs.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddTsTimeForOutputs < ActiveRecord::Migration[5.2]
- def change
- #add_column :outputs, :ts_time, :float
- end
-end
diff --git a/db/migrate/20190720121537_add_is_md_for_messages.rb b/db/migrate/20190720121537_add_is_md_for_messages.rb
deleted file mode 100644
index a801fb387..000000000
--- a/db/migrate/20190720121537_add_is_md_for_messages.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIsMdForMessages < ActiveRecord::Migration[5.2]
- def change
- add_column :messages, :is_md, :boolean, :default => true
- end
-end
diff --git a/db/migrate/20190720122123_modify_is_md_for_messages.rb b/db/migrate/20190720122123_modify_is_md_for_messages.rb
deleted file mode 100644
index 4137fc8af..000000000
--- a/db/migrate/20190720122123_modify_is_md_for_messages.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class ModifyIsMdForMessages < ActiveRecord::Migration[5.2]
- def change
- Message.find_each do |m|
- m.update_column(:is_md, false)
- end
- end
-end
diff --git a/db/migrate/20190722062801_modify_answer_for_challenges.rb b/db/migrate/20190722062801_modify_answer_for_challenges.rb
deleted file mode 100644
index 747564d68..000000000
--- a/db/migrate/20190722062801_modify_answer_for_challenges.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class ModifyAnswerForChallenges < ActiveRecord::Migration[5.2]
- def change
- challenges = Challenge.where("answer is not null or answer != ''")
- .includes(:challenge_answers).unscoped
- challenges.find_each do |c|
- next if c.challenge_answers.present?
- puts("############challenge_id:##{c.id}")
- ChallengeAnswer.create(name: "解题代码", contents: "#{c.answer}", level: 1, score: 100, challenge_id: c.id)
- end
- end
-end
diff --git a/db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb b/db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb
deleted file mode 100644
index a85152894..000000000
--- a/db/migrate/20190723152256_delete_contents_is_null_for_challenge_answers.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class DeleteContentsIsNullForChallengeAnswers < ActiveRecord::Migration[5.2]
- def change
- contents = ChallengeAnswer.where("contents = ''")
- contents.delete_all
- end
-end
diff --git a/db/migrate/20190724013024_modify_final_score_for_games.rb b/db/migrate/20190724013024_modify_final_score_for_games.rb
deleted file mode 100644
index e926cccd6..000000000
--- a/db/migrate/20190724013024_modify_final_score_for_games.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class ModifyFinalScoreForGames < ActiveRecord::Migration[5.2]
- def change
- grades = Grade.where(container_type: "Answer")
- grades.each do |grade|
- g = Game.find_by_id(grade.container_id)
- if g.present?
- if g.status == 2 && g.answer_open > 0 && g.final_score <= 0 && g.end_time < grade.created_at
- g.update_column(:final_score, g.challenge.score)
- elsif g.final_score < 0
- g.update_column(:final_score, 0)
- end
- end
- end
- end
-end
diff --git a/db/migrate/20190726082937_add_is_md_for_homeworks.rb b/db/migrate/20190726082937_add_is_md_for_homeworks.rb
deleted file mode 100644
index 0b25dde97..000000000
--- a/db/migrate/20190726082937_add_is_md_for_homeworks.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class AddIsMdForHomeworks < ActiveRecord::Migration[5.2]
- def change
- # add_column :homework_commons, :is_md, :boolean, :default => true
- # add_column :homework_banks, :is_md, :boolean, :default => true
- #
- #
- # add_column :exercise_questions,:is_md, :boolean, :default => true
- # add_column :poll_questions,:is_md, :boolean, :default => true
- #
- # add_column :exercise_bank_questions, :is_md, :boolean, :default => true
- end
-end
diff --git a/db/migrate/20190726083814_migrate_course_is_md.rb b/db/migrate/20190726083814_migrate_course_is_md.rb
deleted file mode 100644
index 6988db14a..000000000
--- a/db/migrate/20190726083814_migrate_course_is_md.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class MigrateCourseIsMd < ActiveRecord::Migration[5.2]
- def change
- # HomeworkCommon.where(homework_type: [1, 3]).where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false)
- # HomeworkBank.where(homework_type: [1, 3]).where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false)
- #
- # HomeworkCommon.where(homework_type: [1, 3]).where("created_at >= '2019-07-21 00:00:00' and homework_bank_id is not null").each do |homework|
- #
- # end
- #
- # ExerciseQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false)
- # PollQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false)
- # ExerciseBankQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false)
- end
-end
diff --git a/db/migrate/20190729080935_modify_login_for_users.rb b/db/migrate/20190729080935_modify_login_for_users.rb
deleted file mode 100644
index 60e5e0964..000000000
--- a/db/migrate/20190729080935_modify_login_for_users.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class ModifyLoginForUsers < ActiveRecord::Migration[5.2]
- def change
- users = User.where("created_on > '2019-07-26 19:00:00'")
- users.find_each do |use|
- use.update_attributes(login: use.login&.strip, phone: use.phone&.strip)
- use.user_extension.update_column(:student_id, use.user_extension&.student_id&.strip) if use.user_extension
- end
- end
-end
diff --git a/db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb b/db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb
deleted file mode 100644
index ef5b86975..000000000
--- a/db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class DeleteErrorMyshixunFromMyshxiuns < ActiveRecord::Migration[5.2]
- def change
- myshixuns = Myshixun.where("created_at > '2019-07-26 00:00:00' and repo_name is null")
- myshixuns.find_each do |myshixun|
- if myshixun.games.blank?
- puts("###########user_login: #{User.find(myshixun.user_id).login}")
- myshixun.destroy!
- end
- end
- end
-end
diff --git a/db/migrate/20190729122213_delete_myshixun_games_for_users.rb b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb
deleted file mode 100644
index d52369828..000000000
--- a/db/migrate/20190729122213_delete_myshixun_games_for_users.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class DeleteMyshixunGamesForUsers < ActiveRecord::Migration[5.2]
- def change
- myshixuns = Myshixun.where("created_at > '2019-07-26 19:00:00' and repo_name is null")
- myshixuns.find_each do |m|
- if m.games.count == m.games.select{|g| g.status == 3}.count
- puts("#######login: #{User.find(m.user_id).login}")
- m.destroy!
- end
- end
- end
-end
diff --git a/db/migrate/20190801075337_add_praises_count_to_memos.rb b/db/migrate/20190801075337_add_praises_count_to_memos.rb
deleted file mode 100644
index 0cc2259e2..000000000
--- a/db/migrate/20190801075337_add_praises_count_to_memos.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class AddPraisesCountToMemos < ActiveRecord::Migration[5.2]
- def change
- add_column :memos, :praises_count, :integer, :default => 0
-
- memos = Memo.includes(:praise_treads).all
- memos.find_each do |m|
- puts("####{m.id}")
- praises_count = m.praise_treads.select{|pt| pt.praise_or_tread == 1}.count
- m.update_column(:praises_count, praises_count)
- end
- end
-end
diff --git a/db/migrate/20190801084533_add_praises_count_to_libraries.rb b/db/migrate/20190801084533_add_praises_count_to_libraries.rb
deleted file mode 100644
index b773cf918..000000000
--- a/db/migrate/20190801084533_add_praises_count_to_libraries.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddPraisesCountToLibraries < ActiveRecord::Migration[5.2]
- def change
- # add_column :libraries, :praises_count, :integer, :default => 0
- #
- # Library.find_each do |library|
- # praises_count = library.praise_treads.count
- # library.update_column(:praises_count, praises_count)
- # end
- end
-end
diff --git a/db/migrate/20190802105008_tranfer_tiding_data.rb b/db/migrate/20190802105008_tranfer_tiding_data.rb
deleted file mode 100644
index ef7682530..000000000
--- a/db/migrate/20190802105008_tranfer_tiding_data.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class TranferTidingData < ActiveRecord::Migration[5.2]
- def change
- Tiding.where(container_type: 'ApplyAddSchool').update_all(container_type: 'ApplyAddSchools')
- end
-end
diff --git a/db/migrate/20190805004505_sync_index_to_users.rb b/db/migrate/20190805004505_sync_index_to_users.rb
deleted file mode 100644
index 33adca30c..000000000
--- a/db/migrate/20190805004505_sync_index_to_users.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class SyncIndexToUsers < ActiveRecord::Migration[5.2]
- def change
- add_index :users, :login, unique: true
- add_index :users, :mail, unique: true
- add_index :users, :phone, unique: true
- end
-end
diff --git a/db/migrate/20190805010562_modify_ke_contents_for_markdown.rb b/db/migrate/20190805010562_modify_ke_contents_for_markdown.rb
deleted file mode 100644
index 958b70448..000000000
--- a/db/migrate/20190805010562_modify_ke_contents_for_markdown.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
- include ActionView::Helpers::SanitizeHelper
- def change
- # def ke_transform_to_md content
- # return content if content.blank?
- # s_contents = sanitize(content, tags: %w(img a table td tr tbody pre), attributes: %w(src href target style))
- # s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", "").gsub(/(\n)+/, "
")
- # .gsub("\t", "").gsub("\n", "").gsub(" ", " ").gsub(/(
)+/, "
")
- # s_contents.gsub("\n", "
").gsub(/(
)+/, "
")
- # end
- #
- # # 课程讨论区
- # MessageDetail.find_each do |m|
- # content = ke_transform_to_md m.content
- # m.update_column(:content, content)
- # end
-
- #试卷的标题
- # ExerciseQuestion.where(:exercise_id => 1892).find_each do |eq|
- # puts("#eq.question_title: #{eq.question_title}")
- # question_title = ke_transform_to_md eq.question_title
- # puts("#question_title: #{question_title}")
- # eq.update_column(:question_title, question_title)
- # end
-
- # # 试卷的答案
- # ExerciseStandardAnswer.find_each do |esa|
- # answer_text = ke_transform_to_md esa.answer_text
- # esa.update_column(:answer_text, answer_text)
- # end
- #
- # 试卷题库的问题标题
- # ExerciseBankQuestion.find_each do |ebq|
- # question_title = ke_transform_to_md ebq.question_title
- # ebq.update_column(:question_title, question_title)
- # end
- #
- # # 试卷答案
- # ExerciseBankStandardAnswer.find_each do |ebsa|
- # answer_text = ke_transform_to_md ebsa.answer_text
- # ebsa.update_column(:answer_text, answer_text)
- # end
-
- # # 问卷的标题
- # PollQuestion.find_each do |pq|
- # question_title = ke_transform_to_md pq.question_title
- # pq.update_column(:question_title, question_title)
- # end
-
- end
-end
diff --git a/db/migrate/20190805014624_migrate_anonymous_tiding_type.rb b/db/migrate/20190805014624_migrate_anonymous_tiding_type.rb
deleted file mode 100644
index cd45ec196..000000000
--- a/db/migrate/20190805014624_migrate_anonymous_tiding_type.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class MigrateAnonymousTidingType < ActiveRecord::Migration[5.2]
- def change
- Tiding.where(container_type: "StudentWorksScore", extra: "3").update_all(tiding_type: "System", trigger_user_id: 0)
- Tiding.where(container_type: "StudentWorksScoresAppeal", parent_container_type: "StudentWork", tiding_type: "HomeworkCommon").update_all(tiding_type: "System", trigger_user_id: 0)
- end
-end
diff --git a/db/migrate/20190805061306_add_exec_time_to_evaluate_records.rb b/db/migrate/20190805061306_add_exec_time_to_evaluate_records.rb
deleted file mode 100644
index 95edeb7d5..000000000
--- a/db/migrate/20190805061306_add_exec_time_to_evaluate_records.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddExecTimeToEvaluateRecords < ActiveRecord::Migration[5.2]
- def change
- # remove_columns :evaluate_records, :exec_time if EvaluateRecord.first.attributes.include?("exec_time")
- #
- # add_column :evaluate_records, :exec_time, :integer
- end
-end
diff --git a/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb b/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb
deleted file mode 100644
index c8068e049..000000000
--- a/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-class SecondMofidyKeContentsForMd < ActiveRecord::Migration[5.2]
- include ActionView::Helpers::SanitizeHelper
- def change
- # def ke_transform_to_md content
- # return content if content.blank?
- # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style))
- # s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", " ").gsub(/(\n)+/, "
")
- # .gsub("\t", " ").gsub("\n", "").gsub(" ", " ").gsub(/(
)+/, "
")
- #
- # end
- #
- # # 作业
- # HomeworkCommon.find_each do |hc|
- # description = ke_transform_to_md hc.description
- # reference_answer = ke_transform_to_md hc.reference_answer
- # explanation = ke_transform_to_md hc.explanation
- # hc.update_attributes(description: description, reference_answer: reference_answer, explanation: explanation)
- # end
- #
- # # 作业题库
- # HomeworkBank.find_each do |hb|
- # description = ke_transform_to_md hb.description
- # reference_answer = ke_transform_to_md hb.reference_answer
- # hb.update_attributes(description: description, reference_answer: reference_answer)
- # end
- #
- # # 毕业任务
- # GraduationTask.find_each do |gt|
- # description = ke_transform_to_md gt.description
- # gt.update_column(:description, description)
- # end
- #
- # # 毕设选题
- # GraduationTopic.find_each do |gt|
- # description = ke_transform_to_md gt.description
- # gt.update_column(:description, description)
- # end
- #
- # # 毕设作品
- # GraduationWork.find_each do |gw|
- # description = ke_transform_to_md gw.description
- # gw.update_column(:description, description)
- # end
- #
- # # 毕设任务题库
- # GtaskBank.find_each do |gb|
- # description = ke_transform_to_md gb.description
- # gb.update_column(:description, description)
- # end
- #
- # # 毕设选题题库
- # GtopicBank.find_each do |gb|
- # description = ke_transform_to_md gb.description
- # gb.update_column(:description, description)
- # end
- #
- # # 交流问答
- # Memo.find_each do |m|
- # content = ke_transform_to_md m.content
- # m.update_column(:content, content)
- # end
-
- end
-end
diff --git a/db/migrate/20190806063903_third_modify_ke_for_student_work.rb b/db/migrate/20190806063903_third_modify_ke_for_student_work.rb
deleted file mode 100644
index 0b1be8d00..000000000
--- a/db/migrate/20190806063903_third_modify_ke_for_student_work.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class ThirdModifyKeForStudentWork < ActiveRecord::Migration[5.2]
- include ActionView::Helpers::SanitizeHelper
- def change
- # def ke_transform_to_md content
- # return content if content.blank?
- # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style))
- # s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", " ").gsub(/(\n)+/, "
")
- # .gsub("\t", " ").gsub("\n", "").gsub(" ", " ").gsub(/(
)+/, "
")
- # end
- #
- # # 学生的作品 过滤掉一些描述的ke图片的作品
- # StudentWork.where("description is not null and LENGTH(description) < 1000000").find_each do |sw|
- # description = ke_transform_to_md sw.description
- # sw.update_column(:description, description)
- # end
- end
-end
diff --git a/db/migrate/20190808025851_create_videos.rb b/db/migrate/20190808025851_create_videos.rb
deleted file mode 100644
index e7d89f7eb..000000000
--- a/db/migrate/20190808025851_create_videos.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class CreateVideos < ActiveRecord::Migration[5.2]
- def change
- create_table :videos do |t|
- t.references :user, index: true, type: :integer
- t.string :title
- t.string :uuid, comment: 'Aliyun媒体ID'
- t.string :cover_url, comment: '视频封面'
- t.string :file_url, comment: '视频地址'
-
- t.string :status
- t.string :vod_status, comment: 'Aliyun媒体状态'
-
- t.datetime :published_at, index: true
-
- t.timestamps
-
- t.index :uuid, unique: true
- end
- end
-end
diff --git a/db/migrate/20190809010636_create_video_applies.rb b/db/migrate/20190809010636_create_video_applies.rb
deleted file mode 100644
index e8b4037c5..000000000
--- a/db/migrate/20190809010636_create_video_applies.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateVideoApplies < ActiveRecord::Migration[5.2]
- def change
- create_table :video_applies do |t|
- t.references :video, index: true, type: :integer
- t.string :status
- t.string :reason
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190813015633_add_new_column_to_course.rb b/db/migrate/20190813015633_add_new_column_to_course.rb
deleted file mode 100644
index cfadc4ce4..000000000
--- a/db/migrate/20190813015633_add_new_column_to_course.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class AddNewColumnToCourse < ActiveRecord::Migration[5.2]
- def change
- add_column :courses, :start_date, :date
- add_column :courses, :subject_id, :integer, default: 0
-
- add_index :courses, :subject_id
- end
-end
diff --git a/db/migrate/20190813074730_add_excellent_to_courses.rb b/db/migrate/20190813074730_add_excellent_to_courses.rb
deleted file mode 100644
index c83fcc702..000000000
--- a/db/migrate/20190813074730_add_excellent_to_courses.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddExcellentToCourses < ActiveRecord::Migration[5.2]
- def change
- add_column :courses, :excellent, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190815064542_modify_class_period_for_courses.rb b/db/migrate/20190815064542_modify_class_period_for_courses.rb
deleted file mode 100644
index c0f8600b4..000000000
--- a/db/migrate/20190815064542_modify_class_period_for_courses.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class ModifyClassPeriodForCourses < ActiveRecord::Migration[5.2]
- def change
- Course.find_each do |c|
- c.update_column(:class_period, c.class_period.to_i)
- end
- change_column :courses, :class_period, :integer
- end
-end
diff --git a/db/migrate/20190815085136_modify_path_for_challenges.rb b/db/migrate/20190815085136_modify_path_for_challenges.rb
deleted file mode 100644
index a17fdbd04..000000000
--- a/db/migrate/20190815085136_modify_path_for_challenges.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ModifyPathForChallenges < ActiveRecord::Migration[5.2]
- def change
- change_column :challenges, :path, :text
- end
-end
diff --git a/db/migrate/20190819081514_add_filesize_to_videos.rb b/db/migrate/20190819081514_add_filesize_to_videos.rb
deleted file mode 100644
index da5b6fb50..000000000
--- a/db/migrate/20190819081514_add_filesize_to_videos.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddFilesizeToVideos < ActiveRecord::Migration[5.2]
- def change
- add_column :videos, :filesize, :integer, default: 0
- end
-end
diff --git a/db/migrate/20190820021047_migrate_course_task_position.rb b/db/migrate/20190820021047_migrate_course_task_position.rb
deleted file mode 100644
index f32ac88b1..000000000
--- a/db/migrate/20190820021047_migrate_course_task_position.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateCourseTaskPosition < ActiveRecord::Migration[5.2]
- def change
- add_column :homework_commons, :position, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190820102040_change_exercise_1930_position.rb b/db/migrate/20190820102040_change_exercise_1930_position.rb
deleted file mode 100644
index acf99b9e5..000000000
--- a/db/migrate/20190820102040_change_exercise_1930_position.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class ChangeExercise1930Position < ActiveRecord::Migration[5.2]
- def change
- exs = Exercise.all.includes(:exercise_questions)
- exs.each do |ex|
- ex_questions = ex&.exercise_questions&.select(:id,:question_number,:exercise_id)&.order("question_number ASC") #试卷的位置迁移
- if ex_questions.present?
- ex_questions.each_with_index do |q,index|
- puts index
- q_num = index + 1
- if q.question_number.to_i != q_num
- q.update_attributes(question_number: q_num)
- end
- end
- end
-
- ex_q_bank = ex&.exercise_bank&.exercise_bank_questions&.select(:id,:question_number,:exercise_bank_id,:shixun_id)&.order("question_number ASC") #试卷的习题库位置迁移
- if ex_q_bank.present?
- ex_q_bank.each_with_index do |q,index|
- puts index
- q_num_1 = index + 1
- if q.question_number.to_i != q_num_1
- q.update_attributes(question_number: q_num_1)
- end
- end
- end
- end
-
- end
-end
diff --git a/db/migrate/20190821054352_create_open_users.rb b/db/migrate/20190821054352_create_open_users.rb
deleted file mode 100644
index f8e0aba4b..000000000
--- a/db/migrate/20190821054352_create_open_users.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class CreateOpenUsers < ActiveRecord::Migration[5.2]
- def change
- create_table :open_users do |t|
- t.references :user
-
- t.string :type
- t.string :uid
-
- t.timestamps
-
- t.index [:type, :uid], unique: true
- end
- end
-end
diff --git a/db/migrate/20190821072722_migrate_course_shixun_homework_position.rb b/db/migrate/20190821072722_migrate_course_shixun_homework_position.rb
deleted file mode 100644
index 9a19b12e3..000000000
--- a/db/migrate/20190821072722_migrate_course_shixun_homework_position.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class MigrateCourseShixunHomeworkPosition < ActiveRecord::Migration[5.2]
- def change
- Course.find_each do |course|
- puts course.id
- course.practice_homeworks.order("IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
- homework_commons.created_at DESC").reverse.each_with_index do |homework, index|
- homework.update_columns(position: index + 1)
- end
- end
- end
-end
diff --git a/db/migrate/20190822022306_add_exercise_user_update.rb b/db/migrate/20190822022306_add_exercise_user_update.rb
deleted file mode 100644
index 7a8784c30..000000000
--- a/db/migrate/20190822022306_add_exercise_user_update.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-class AddExerciseUserUpdate < ActiveRecord::Migration[5.2]
-
- # include ExercisesHelper
- # def change
- # #2019,8,22添加
- # two_months = Time.now - 2.months
- # exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users)
- # exs.each do |ex|
- # if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新
- # ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months)
- # if ex_users.exists?
- # ex_users.each do |ex_user|
- # calculate_score = calculate_student_score(ex,ex_user.user)[:total_score]
- # subjective_score = ex_user.subjective_score
- # total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
- # total_score = calculate_score + total_score_subjective_score
- # ex_user.update_attributes(score:total_score,objective_score:calculate_score)
- # puts ex_user.id
- # end
- # end
- # end
- # end
- #
- # #1936的试卷成绩有问题。
- # # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
- # ex_special = Exercise.find_by_id(1936)
- # ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months)
- # if ex_special.present? && ex_special_users.exists?
- # ex_special_users.each do |ex_user|
- # calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
- # subjective_score = ex_user.subjective_score
- # total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
- # total_score = calculate_score + total_score_subjective_score
- # ex_user.update_attributes(score:total_score,objective_score:calculate_score)
- # puts ex_user.id
- # end
- # end
- # end
-end
diff --git a/db/migrate/20190823015610_add_message_count_for_boards.rb b/db/migrate/20190823015610_add_message_count_for_boards.rb
deleted file mode 100644
index 6f121cfc0..000000000
--- a/db/migrate/20190823015610_add_message_count_for_boards.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddMessageCountForBoards < ActiveRecord::Migration[5.2]
- def change
- boards = Board.where(:parent_id => 0)
- Board.reset_column_information
- boards.find_each do |board|
- Board.reset_counters board.id, :messages
- end
- end
-end
diff --git a/db/migrate/20190823024643_modify_course_introduction_for_boards.rb b/db/migrate/20190823024643_modify_course_introduction_for_boards.rb
deleted file mode 100644
index 3dfcf09f8..000000000
--- a/db/migrate/20190823024643_modify_course_introduction_for_boards.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-class ModifyCourseIntroductionForBoards < ActiveRecord::Migration[5.2]
- def change
- platform = PlatformSample.where(:samples_type => "courseGuide").first
- content = '大家好!
-
-欢迎进入在线课堂!
-
-该课堂对应于一个或多个线下班级,课堂成员可以利用老师发布的邀请码申请加入。
-
-在这里,老师和教辅将结合教学内容,把不同类型的实训项目发布给大家,让大家在真实的实战环境中得到锻炼。
-
-那么什么是实训项目呢?大家有空自己尝试一下就知道了:
-
-- Python实训:[Python程序设计入门](https://www.educoder.net/paths/13) | [大学计算机基础——基于Python](https://www.educoder.net/paths/11)
-
-- Java实训:[Java语言程序设计(基础篇)](https://www.educoder.net/paths/38)
-
-- C/C++实训:[C/C++程序设计](https://www.educoder.net/paths/3) | [数据结构与算法(C语言)](https://www.educoder.net/paths/4)
-
-- Matlab实训:[智取MATLAB:基本语法](https://www.educoder.net/shixuns/7bvs54gw/challenges) | [控制结构](https://www.educoder.net/shixuns/q4fowkfa/challenges) | [矩阵进阶](https://www.educoder.net/shixuns/grunzcs3/challenges)
-
-- HTML/CSS实训:[HTML5+CSS3网页制作(基础篇)](https://www.educoder.net/paths/15)
-
-- 云计算实训:[Docker企业级实训(基础篇)](https://www.educoder.net/paths/29)
-
-... ... 等等
-
-你们现在就可以去体验哦!
-
-欢迎提出宝贵建议,平台一定会给您带来更多惊喜!
-
-
-支持团队'
- platform.update_column(:contents, content)
- messages = Message.where(subject: "新课导语")
- messages.find_each do |m|
- m.update_column(:is_md, true)
- message_detail = m.message_detail
- message_detail.update_column(:content, content) if message_detail
- end
- end
-end
diff --git a/db/migrate/20190823063747_modify_contents_for_old_message_details.rb b/db/migrate/20190823063747_modify_contents_for_old_message_details.rb
deleted file mode 100644
index 4607881fe..000000000
--- a/db/migrate/20190823063747_modify_contents_for_old_message_details.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class ModifyContentsForOldMessageDetails < ActiveRecord::Migration[5.2]
- def change
- messages = Message.where(subject: "新课导语").where.not(parent_id: 0).where("created_on < '2019-08-23 02:00:00'")
- messages.find_each do |m|
- m.update_column(:is_md, true)
- message_detail = m.message_detail
- if message_detail
- content = OldMessageDetail.find_by_id(message_detail.id)&.content
- message_detail.update_column(:content, content)
- end
- end
- end
-end
diff --git a/db/migrate/20190823090957_rechange_exercise_1936_scores.rb b/db/migrate/20190823090957_rechange_exercise_1936_scores.rb
deleted file mode 100644
index f089714ee..000000000
--- a/db/migrate/20190823090957_rechange_exercise_1936_scores.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class RechangeExercise1936Scores < ActiveRecord::Migration[5.2]
- include ExercisesHelper
- def change
- #1936的试卷成绩有问题。
- # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
- ex_special = Exercise.find_by_id(1936)
- ex_special_users = ex_special&.exercise_users&.exercise_user_committed&.where("end_at is not null and end_at > ?",Time.now - 2.months)
- if ex_special.present? && ex_special_users.exists?
- ex_special_users.each do |ex_user|
- calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
- subjective_score = ex_user.subjective_score
- total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
- total_score = calculate_score + total_score_subjective_score
- ex_user.update_attributes(score:total_score,objective_score:calculate_score)
- puts ex_user.id
- end
- end
- end
-end
diff --git a/db/migrate/20190824032658_migrate_subject_shixun_count.rb b/db/migrate/20190824032658_migrate_subject_shixun_count.rb
deleted file mode 100644
index bef29346e..000000000
--- a/db/migrate/20190824032658_migrate_subject_shixun_count.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class MigrateSubjectShixunCount < ActiveRecord::Migration[5.2]
- def change
- Subject.reset_column_information
- Subject.all.each do |subject|
- Subject.reset_counters subject.id, :stage_shixuns
- Subject.reset_counters subject.id, :shixuns
- end
- end
-end
diff --git a/db/migrate/20190827055814_modify_challnege_score_for_choose.rb b/db/migrate/20190827055814_modify_challnege_score_for_choose.rb
deleted file mode 100644
index 7b96877e3..000000000
--- a/db/migrate/20190827055814_modify_challnege_score_for_choose.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class ModifyChallnegeScoreForChoose < ActiveRecord::Migration[5.2]
- def change
- challenges = Challenge.where(st: 1)
- challenges.find_each do |c|
- puts(c.id)
- score = c.challenge_chooses.sum(:score)
- c.update_column(:score, score)
- end
- end
-end
diff --git a/db/migrate/20190828011222_add_update_user_id_to_student_works.rb b/db/migrate/20190828011222_add_update_user_id_to_student_works.rb
deleted file mode 100644
index c8e007998..000000000
--- a/db/migrate/20190828011222_add_update_user_id_to_student_works.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddUpdateUserIdToStudentWorks < ActiveRecord::Migration[5.2]
- def change
- add_column :student_works, :update_user_id, :integer
- StudentWork.update_all("update_user_id = commit_user_id")
- end
-end
diff --git a/db/migrate/20190828055710_add_is_ordered_to_exercise_bank_question.rb b/db/migrate/20190828055710_add_is_ordered_to_exercise_bank_question.rb
deleted file mode 100644
index 967d89e5f..000000000
--- a/db/migrate/20190828055710_add_is_ordered_to_exercise_bank_question.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddIsOrderedToExerciseBankQuestion < ActiveRecord::Migration[5.2]
- def change
- add_column :exercise_bank_questions, :is_ordered, :boolean, :default => true
- end
-end
diff --git a/db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb b/db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb
deleted file mode 100644
index c267284a0..000000000
--- a/db/migrate/20190829025855_migrate_gtopic_bank_is_public.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateGtopicBankIsPublic < ActiveRecord::Migration[5.2]
- def change
- change_column :gtopic_banks, :is_public, :boolean, default: 0
- end
-end
diff --git a/db/migrate/20190829084147_migrate_course_group_position.rb b/db/migrate/20190829084147_migrate_course_group_position.rb
deleted file mode 100644
index 3a71baae4..000000000
--- a/db/migrate/20190829084147_migrate_course_group_position.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class MigrateCourseGroupPosition < ActiveRecord::Migration[5.2]
- def change
- Course.all.each do |course|
- if course.course_groups.exists?(position: 0)
- course.course_groups.each_with_index do |group, index|
- group.update_attributes(position: index+1)
- end
- end
- end
- end
-end
diff --git a/db/migrate/20190830064803_add_announcement_to_course_modules.rb b/db/migrate/20190830064803_add_announcement_to_course_modules.rb
deleted file mode 100644
index 5f4d1eeb9..000000000
--- a/db/migrate/20190830064803_add_announcement_to_course_modules.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddAnnouncementToCourseModules < ActiveRecord::Migration[5.2]
- def change
- Course.all.each do |course|
- unless course.course_modules.exists?(module_type: "announcement")
- course.course_modules.where.not(module_type: "activity").update_all("position = position + 1")
- course.course_modules << CourseModule.new(module_type: "announcement", hidden: 1, module_name: "公告栏", position: 2)
- end
- end
- end
-end
diff --git a/db/migrate/20190830082934_add_tag_to_libraries.rb b/db/migrate/20190830082934_add_tag_to_libraries.rb
deleted file mode 100644
index ea40cda5d..000000000
--- a/db/migrate/20190830082934_add_tag_to_libraries.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddTagToLibraries < ActiveRecord::Migration[5.2]
- def change
- execute "insert into library_tags(name) values('企业案例')"
- end
-end
diff --git a/db/migrate/20190831014325_migrate_poll_bank_question.rb b/db/migrate/20190831014325_migrate_poll_bank_question.rb
deleted file mode 100644
index cd9168a73..000000000
--- a/db/migrate/20190831014325_migrate_poll_bank_question.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class MigratePollBankQuestion < ActiveRecord::Migration[5.2]
- def change
- ExerciseBankQuestion.where(question_type: 0, exercise_bank_id: ExerciseBank.where(container_type: 'Poll').pluck(:id)).update_all(question_type: 1)
- ExerciseBankQuestion.where(question_type: 1, exercise_bank_id: ExerciseBank.where(container_type: 'Poll').pluck(:id)).update_all(question_type: 2)
- end
-end
diff --git a/db/migrate/20190902062449_migrate_excellent_course_course_list.rb b/db/migrate/20190902062449_migrate_excellent_course_course_list.rb
deleted file mode 100644
index a93db7695..000000000
--- a/db/migrate/20190902062449_migrate_excellent_course_course_list.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class MigrateExcellentCourseCourseList < ActiveRecord::Migration[5.2]
- def change
- courses = Course.where(excellent: true)
- courses.each do |course|
- if !course.course_list.present? && course.subject
- subject = course.subject
- course_list = CourseList.find_by(name: subject.name) || CourseList.create!(name: subject.name, user_id: course.tea_id, is_admin: 0)
- course.update_attributes(course_list_id: course_list.id)
- end
- end
- end
-end
diff --git a/db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb b/db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb
deleted file mode 100644
index e1db275fb..000000000
--- a/db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddGraduationWorkIdToGroupAssignations < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_task_group_assignations, :graduation_work_id, :integer, default: 0
-
- add_index :graduation_task_group_assignations, :graduation_work_id
- end
-end
diff --git a/db/migrate/20190903025159_add_temporary_to_graduation.rb b/db/migrate/20190903025159_add_temporary_to_graduation.rb
deleted file mode 100644
index adf7e1aa3..000000000
--- a/db/migrate/20190903025159_add_temporary_to_graduation.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddTemporaryToGraduation < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_task_group_assignations, :temporary, :integer, default: 0
- add_column :graduation_work_comment_assignations, :temporary, :integer, default: 0
- end
-end
diff --git a/db/migrate/20190905070518_reorder_coo_img_position.rb b/db/migrate/20190905070518_reorder_coo_img_position.rb
deleted file mode 100644
index 1aa8a6842..000000000
--- a/db/migrate/20190905070518_reorder_coo_img_position.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class ReorderCooImgPosition < ActiveRecord::Migration[5.2]
- def change
- CooImg.all.group_by(&:img_type).each do |_type, objs|
- objs.sort_by(&:position).each_with_index do |obj, index|
- obj.update!(position: index + 1)
- end
- end
- end
-end
diff --git a/db/migrate/20190905070821_change_public_model_default_value.rb b/db/migrate/20190905070821_change_public_model_default_value.rb
deleted file mode 100644
index 09d4af61a..000000000
--- a/db/migrate/20190905070821_change_public_model_default_value.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class ChangePublicModelDefaultValue < ActiveRecord::Migration[5.2]
- def change
- #试卷的默认值的修改
- change_column_default :exercises,:show_result,0
- change_column_default :exercises, :answer_open, false
- change_column_default :exercises, :score_open, false
-
- #问卷的默认值的修改
- change_column_default :polls, :show_result, 0
-
- #实训作业/普通作业/分组作业
- change_column_default :homework_commons, :score_open, false
- change_column_default :homework_commons, :work_public, false
- change_column_default :homework_commons, :answer_public, false
-
- #毕设任务
- change_column_default :graduation_tasks, :open_score, false
- change_column_default :graduation_tasks, :open_work, false
- end
-end
diff --git a/db/migrate/20190906062930_modify_is_test_for_user.rb b/db/migrate/20190906062930_modify_is_test_for_user.rb
deleted file mode 100644
index f3f5bfd3b..000000000
--- a/db/migrate/20190906062930_modify_is_test_for_user.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class ModifyIsTestForUser < ActiveRecord::Migration[5.2]
- def change
- change_column :users, :is_test, :integer, :limit => 1
- end
-end
diff --git a/db/migrate/20190906111746_gtopic_bank_is_public.rb b/db/migrate/20190906111746_gtopic_bank_is_public.rb
deleted file mode 100644
index 193824dc4..000000000
--- a/db/migrate/20190906111746_gtopic_bank_is_public.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class GtopicBankIsPublic < ActiveRecord::Migration[5.2]
- def change
- GtopicBank.where(is_public: nil).update_all(is_public: 0)
- end
-end
diff --git a/db/migrate/20190907014649_add_vnc_evaluate_for_shixuns.rb b/db/migrate/20190907014649_add_vnc_evaluate_for_shixuns.rb
deleted file mode 100644
index 861c4501e..000000000
--- a/db/migrate/20190907014649_add_vnc_evaluate_for_shixuns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddVncEvaluateForShixuns < ActiveRecord::Migration[5.2]
- def change
- add_column :shixuns, :vnc_evaluate, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190907021100_migrate_bank_reference_id.rb b/db/migrate/20190907021100_migrate_bank_reference_id.rb
deleted file mode 100644
index c71034167..000000000
--- a/db/migrate/20190907021100_migrate_bank_reference_id.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-class MigrateBankReferenceId < ActiveRecord::Migration[5.2]
- def change
- HomeworkBank.all.each do |bank|
- if bank.homework_common
- bank.homework_common.update_column("homework_bank_id", bank.id) if bank.homework_common.homework_bank_id.nil?
- end
- end
-
- GtopicBank.all.each do |bank|
- if bank.graduation_topic
- bank.graduation_topic.update_column("gtopic_bank_id", bank.id) if bank.graduation_topic.gtopic_bank_id.nil?
- end
- end
-
- GtaskBank.all.each do |bank|
- if bank.graduation_task
- bank.graduation_task.update_column("gtask_bank_id", bank.id) if bank.graduation_task.gtask_bank_id.nil?
- end
- end
-
- ExerciseBank.all.each do |bank|
- if bank.container_type == 'Exercise'
- exercise = Exercise.find_by(id: bank.container_id)
- exercise.update_column("exercise_bank_id", bank.id) if exercise && exercise.exercise_bank_id.nil?
- elsif bank.container_type == 'Poll'
- poll = Poll.find_by(id: bank.container_id)
- poll.update_column("exercise_bank_id", bank.id) if poll && poll.exercise_bank_id.nil?
- end
- end
- end
-end
diff --git a/db/migrate/20190907061918_migrate_bank_quotes.rb b/db/migrate/20190907061918_migrate_bank_quotes.rb
deleted file mode 100644
index 9f278860d..000000000
--- a/db/migrate/20190907061918_migrate_bank_quotes.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-class MigrateBankQuotes < ActiveRecord::Migration[5.2]
- def change
- HomeworkBank.all.each do |bank|
- task_count = bank.homework_commons.count
- bank.update_column("quotes", task_count == 0 ? 1 : task_count)
- end
-
- GtopicBank.all.each do |bank|
- task_count = bank.graduation_topics.count
- bank.update_column("quotes", task_count == 0 ? 1 : task_count)
- end
-
- GtaskBank.all.each do |bank|
- task_count = bank.graduation_tasks.count
- bank.update_column("quotes", task_count == 0 ? 1 : task_count)
- end
-
- ExerciseBank.all.each do |bank|
- if bank.container_type == 'Exercise'
- task_count = bank.exercises.count
- bank.update_column("quotes", task_count == 0 ? 1 : task_count)
- elsif bank.container_type == 'Poll'
- task_count = bank.polls.count
- bank.update_column("quotes", task_count == 0 ? 1 : task_count)
- end
- end
- end
-end
diff --git a/db/migrate/20190909061930_create_shixun_secret_repositories.rb b/db/migrate/20190909061930_create_shixun_secret_repositories.rb
deleted file mode 100644
index 5526869f8..000000000
--- a/db/migrate/20190909061930_create_shixun_secret_repositories.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateShixunSecretRepositories < ActiveRecord::Migration[5.2]
- def change
- create_table :shixun_secret_repositories do |t|
- t.references :shixun
- t.string :repo_name
- t.string :secret_dir_path
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190909072626_add_match_rule_for_test_sets.rb b/db/migrate/20190909072626_add_match_rule_for_test_sets.rb
deleted file mode 100644
index 2d9d53f0f..000000000
--- a/db/migrate/20190909072626_add_match_rule_for_test_sets.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddMatchRuleForTestSets < ActiveRecord::Migration[5.2]
- def change
- add_column :test_sets, :match_rule, :string
- TestSet.update_all(match_rule: 'full')
-
- end
-end
diff --git a/db/migrate/20190909080508_create_shixun_work_comments.rb b/db/migrate/20190909080508_create_shixun_work_comments.rb
deleted file mode 100644
index eb21f0d04..000000000
--- a/db/migrate/20190909080508_create_shixun_work_comments.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class CreateShixunWorkComments < ActiveRecord::Migration[5.2]
- def change
- create_table :shixun_work_comments do |t|
- t.references :student_work, index: true, type: :integer
- t.references :challenge, index: true, type: :integer, default: 0
- t.references :user, index: true, type: :integer
- t.text :comment
- t.text :hidden_comment
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190909082555_migrate_shixun_work_comment.rb b/db/migrate/20190909082555_migrate_shixun_work_comment.rb
deleted file mode 100644
index f58531b80..000000000
--- a/db/migrate/20190909082555_migrate_shixun_work_comment.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class MigrateShixunWorkComment < ActiveRecord::Migration[5.2]
- def change
- StudentWorksScore.where(is_ultimate: 0, score: nil).where("created_at > '2019-09-04 00:00:00'").each do |work_score|
- if work_score.student_work && work_score.student_work.homework_common&.shixuns
- if work_score.is_hidden
- ShixunWorkComment.create!(student_work_id: work_score.student_work_id, user_id: work_score.user_id, hidden_comment: work_score.comment)
- else
- ShixunWorkComment.create!(student_work_id: work_score.student_work_id, user_id: work_score.user_id, comment: work_score.comment)
- end
- end
- end
- end
-end
diff --git a/db/migrate/20190910061807_create_course_stages.rb b/db/migrate/20190910061807_create_course_stages.rb
deleted file mode 100644
index c664b7f92..000000000
--- a/db/migrate/20190910061807_create_course_stages.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class CreateCourseStages < ActiveRecord::Migration[5.2]
- def change
- create_table :course_stages do |t|
- t.references :course, index: true
- t.string :name
- t.text :description
- t.integer :position
- t.integer :shixuns_count
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190910062710_create_course_stage_shixuns.rb b/db/migrate/20190910062710_create_course_stage_shixuns.rb
deleted file mode 100644
index 04512c7da..000000000
--- a/db/migrate/20190910062710_create_course_stage_shixuns.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class CreateCourseStageShixuns < ActiveRecord::Migration[5.2]
- def change
- create_table :course_stage_shixuns do |t|
- t.references :course, index: true
- t.references :course_stage, index: true
- t.references :shixun, index: true
- t.integer :position
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190910063345_migrate_course_stages.rb b/db/migrate/20190910063345_migrate_course_stages.rb
deleted file mode 100644
index 0aae05103..000000000
--- a/db/migrate/20190910063345_migrate_course_stages.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class MigrateCourseStages < ActiveRecord::Migration[5.2]
- def change
- Course.where(excellent: 1).each do |course|
- if course.subject
- course.subject.stages.each do |stage|
- new_stage = CourseStage.create!(course_id: course.id, name: stage.name, description: stage.description, position: stage.position)
- stage.stage_shixuns.each do |stage_shixun|
- CourseStageShixun.create!(course_id: course.id, course_stage_id: new_stage.id, shixun_id: stage_shixun.shixun_id, position: stage_shixun.position)
- end
- end
- end
- end
- end
-end
diff --git a/db/migrate/20190911020749_migrate_shixun_student_work.rb b/db/migrate/20190911020749_migrate_shixun_student_work.rb
deleted file mode 100644
index 54474c544..000000000
--- a/db/migrate/20190911020749_migrate_shixun_student_work.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class MigrateShixunStudentWork < ActiveRecord::Migration[5.2]
- def change
- homework_commons = HomeworkCommon.where(homework_type: 4).where("created_at > '2019-07-01 00:00:00'")
- attrs = %i[homework_common_id user_id created_at updated_at]
- StudentWork.bulk_insert(*attrs) do |worker|
- homework_commons.each do |homework|
- course = homework.course
- if course && homework.student_works.count != course.students.count
- course.students.each do |student|
- next if StudentWork.where(homework_common_id: homework.id, user_id: student.user_id).any?
- same_attrs = {user_id: student.user_id}
- worker.add same_attrs.merge(homework_common_id: homework.id)
- end
- end
- end
- end
- end
-end
diff --git a/db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb b/db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb
deleted file mode 100644
index 801713e0e..000000000
--- a/db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddCodeEditPermissionForShixun < ActiveRecord::Migration[5.2]
- def change
-
- add_column :shixuns, :code_edit_permission, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190911080150_change_ec_course_supports.rb b/db/migrate/20190911080150_change_ec_course_supports.rb
deleted file mode 100644
index 07c3a536d..000000000
--- a/db/migrate/20190911080150_change_ec_course_supports.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class ChangeEcCourseSupports < ActiveRecord::Migration[5.2]
- def change
- add_column :ec_course_supports, :ec_graduation_subitem_id, :integer, index: true
-
- execute <<-SQL
- UPDATE ec_course_supports ecs SET ec_graduation_subitem_id = (
- SELECT ec_graduation_subitem_id FROM ec_graduation_subitem_courses egsc WHERE egsc.ec_course_support_id = ecs.id
- )
- SQL
- end
-end
diff --git a/db/migrate/20190911103449_migrate_grade_index.rb b/db/migrate/20190911103449_migrate_grade_index.rb
deleted file mode 100644
index 0128619fa..000000000
--- a/db/migrate/20190911103449_migrate_grade_index.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class MigrateGradeIndex < ActiveRecord::Migration[5.2]
- def change
- remove_index :grades, [:user_id, :container_id]
- add_index :grades, [:container_id, :container_type]
- add_index :grades, [:user_id]
- end
-end
diff --git a/db/migrate/20190917024120_migrate_graduation_task_comment_status.rb b/db/migrate/20190917024120_migrate_graduation_task_comment_status.rb
deleted file mode 100644
index 3b3a3fccc..000000000
--- a/db/migrate/20190917024120_migrate_graduation_task_comment_status.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class MigrateGraduationTaskCommentStatus < ActiveRecord::Migration[5.2]
- def change
- GraduationTask.where(cross_comment: true, comment_status: 0).update_all(comment_status: 2)
- end
-end
diff --git a/db/migrate/20190920073337_migrate_user_extension_index.rb b/db/migrate/20190920073337_migrate_user_extension_index.rb
deleted file mode 100644
index 1d333bd99..000000000
--- a/db/migrate/20190920073337_migrate_user_extension_index.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class MigrateUserExtensionIndex < ActiveRecord::Migration[5.2]
- def change
- remove_index :user_extensions, :school_id
- add_index :user_extensions, [:school_id, :user_id]
- end
-end
diff --git a/db/migrate/20190921010411_add_course_member_to_subjects.rb b/db/migrate/20190921010411_add_course_member_to_subjects.rb
deleted file mode 100644
index 76df05604..000000000
--- a/db/migrate/20190921010411_add_course_member_to_subjects.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddCourseMemberToSubjects < ActiveRecord::Migration[5.2]
- def change
- add_column :subjects, :student_count, :integer, :default => 0
- add_column :subjects, :participant_count, :integer, :default => 0
- end
-end
diff --git a/db/migrate/20190921015840_create_subject_appointments.rb b/db/migrate/20190921015840_create_subject_appointments.rb
deleted file mode 100644
index 68c924de7..000000000
--- a/db/migrate/20190921015840_create_subject_appointments.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateSubjectAppointments < ActiveRecord::Migration[5.2]
- def change
- create_table :subject_appointments do |t|
- t.references :subject, index: true
- t.references :user, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb b/db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb
deleted file mode 100644
index 718c6adde..000000000
--- a/db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddUpdateUserIdToGraduationWorks < ActiveRecord::Migration[5.2]
- def change
- add_column :graduation_works, :update_user_id, :integer
- GraduationWork.update_all("update_user_id = commit_user_id")
- end
-end
diff --git a/db/migrate/20190926024819_add_library_tag_data.rb b/db/migrate/20190926024819_add_library_tag_data.rb
deleted file mode 100644
index b2b40bbf5..000000000
--- a/db/migrate/20190926024819_add_library_tag_data.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddLibraryTagData < ActiveRecord::Migration[5.2]
- def up
- execute 'INSERT INTO library_tags(id, name) VALUES(4, "高校案例")'
- end
-
- def down
- execute 'DELETE FROM library_tags WHERE id = 4 and name = "高校案例"'
- end
-end
diff --git a/db/migrate/20190927091948_change_user_p02389416_exercise.rb b/db/migrate/20190927091948_change_user_p02389416_exercise.rb
deleted file mode 100644
index c4026f75b..000000000
--- a/db/migrate/20190927091948_change_user_p02389416_exercise.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-class ChangeUserP02389416Exercise < ActiveRecord::Migration[5.2]
- def change
- puts "====> start_to_create user exercise_answer"
-
- #分别为第8,11,14,15,16,20,21,26
- # 分数分别为:2分,2分,5分,2分,2分,2分,2分,2分 合计19分
- question_ids = [37411,37414,37417,37418,37419,37423,37424,37429]
- choice_ids = [117788,117797,117806,117809,117811,117816,117818,117828]
- question_scores = [2,2,5,2,2,2,2,2]
- question_ids.each_with_index do |q, index|
- ex_exercise_user = ExerciseAnswer.where(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index])
- if ex_exercise_user.exists?
- ex_exercise_user.first.update_attribute(:score,question_scores[index])
- else
- ExerciseAnswer.create(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index], score: question_scores[index])
- end
- end
- ex_user = ExerciseUser.where(user_id: 45442, exercise_id: 2561)&.first
- if ex_user.present?
- if ex_user.score > 65 || ex_user.objective_score > 65
- ex_user.update_attributes(score: 65, objective_score: 65)
- else
- obj_score = ex_user.objective_score.to_i + 19
- total_score = ex_user.score.to_i + 19
-
- ex_user.update_attributes(score: total_score, objective_score: obj_score)
- end
-
- end
-
- puts "====> end_to_create user exercise_answer"
- end
-end
diff --git a/db/migrate/20190930020534_migrate_forum_name.rb b/db/migrate/20190930020534_migrate_forum_name.rb
deleted file mode 100644
index 102d8c9a0..000000000
--- a/db/migrate/20190930020534_migrate_forum_name.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class MigrateForumName < ActiveRecord::Migration[5.2]
- def change
- forum = Forum.find_by(id: 16)
- if forum.present?
- forum.update_attributes(name: "通知公告")
- forum.memos.destroy_all
- end
- end
-end
diff --git a/db/migrate/20190930032241_create_diff_records.rb b/db/migrate/20190930032241_create_diff_records.rb
deleted file mode 100644
index 3e02e0a2b..000000000
--- a/db/migrate/20190930032241_create_diff_records.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateDiffRecords < ActiveRecord::Migration[5.2]
- def change
- create_table :diff_records do |t|
- t.references :user
- t.references :container, polymorphic: true
- t.string :column_name
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20190930032255_create_diff_record_contents.rb b/db/migrate/20190930032255_create_diff_record_contents.rb
deleted file mode 100644
index f3d56b8b2..000000000
--- a/db/migrate/20190930032255_create_diff_record_contents.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateDiffRecordContents < ActiveRecord::Migration[5.2]
- def change
- create_table :diff_record_contents do |t|
- t.references :diff_record
-
- t.text :content
- end
- end
-end
diff --git a/db/migrate/20191007010405_resort_portal_image_data.rb b/db/migrate/20191007010405_resort_portal_image_data.rb
deleted file mode 100644
index 665b48466..000000000
--- a/db/migrate/20191007010405_resort_portal_image_data.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class ResortPortalImageData < ActiveRecord::Migration[5.2]
- def change
- PortalImage.order(position: :asc).each_with_index do |image, index|
- image.update!(position: index + 1)
- end
- end
-end
diff --git a/db/migrate/20191010011844_create_laboratories.rb b/db/migrate/20191010011844_create_laboratories.rb
deleted file mode 100644
index 3dfb442f0..000000000
--- a/db/migrate/20191010011844_create_laboratories.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class CreateLaboratories < ActiveRecord::Migration[5.2]
- def change
- create_table :laboratories do |t|
- t.references :school
- t.string :identifier
-
- t.timestamps
-
- t.index :identifier, unique: true
- end
- end
-end
diff --git a/db/migrate/20191010012226_create_laboratory_users.rb b/db/migrate/20191010012226_create_laboratory_users.rb
deleted file mode 100644
index 1b7ae762d..000000000
--- a/db/migrate/20191010012226_create_laboratory_users.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class CreateLaboratoryUsers < ActiveRecord::Migration[5.2]
- def change
- create_table :laboratory_users do |t|
- t.references :laboratory
- t.references :user
- end
- end
-end
diff --git a/db/migrate/20191010063403_create_laboratory_settings.rb b/db/migrate/20191010063403_create_laboratory_settings.rb
deleted file mode 100644
index 7f0a5f015..000000000
--- a/db/migrate/20191010063403_create_laboratory_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateLaboratorySettings < ActiveRecord::Migration[5.2]
- def change
- create_table :laboratory_settings do |t|
- t.references :laboratory
-
- t.text :config
- end
- end
-end
diff --git a/db/migrate/20191011025619_init_edu_coder_laboratory.rb b/db/migrate/20191011025619_init_edu_coder_laboratory.rb
deleted file mode 100644
index 831ca3985..000000000
--- a/db/migrate/20191011025619_init_edu_coder_laboratory.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class InitEduCoderLaboratory < ActiveRecord::Migration[5.2]
- def change
- ActiveRecord::Base.transaction do
- laboratory = Laboratory.create!(id: 1, identifier: 'www')
- setting = laboratory.build_laboratory_setting
- footer = %Q{
-