fix_migrations_1.9.x_1.10.0.php 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <?php
  2. /* For license terms, see /license.txt */
  3. /**
  4. * Fix failed migration 1.9.x to 1.10.0
  5. * Note: You need execute the ./fix_duplicate_settings.php to remove duplicated settings from failed migration
  6. */
  7. exit;
  8. require_once __DIR__.'/../../main/inc/global.inc.php';
  9. api_protect_admin_script();
  10. if (function_exists('ini_set')) {
  11. ini_set('memory_limit', -1);
  12. ini_set('max_execution_time', 0);
  13. echo "memory_limit set to -1" . PHP_EOL;
  14. echo "max_execution_time 0<br>" . PHP_EOL;
  15. } else {
  16. echo "Could not change memory and time limits<br>" . PHP_EOL;
  17. }
  18. echo "<br>" . PHP_EOL;
  19. Database::query("ALTER TABLE sequence ADD name VARCHAR(255) NOT NULL, ADD graph LONGTEXT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP sequence_row_entity_id, DROP sequence_row_entity_id_next, DROP is_part, CHANGE id id INT AUTO_INCREMENT NOT NULL");
  20. Database::query("CREATE TABLE sequence_resource (id INT AUTO_INCREMENT NOT NULL, sequence_id INT DEFAULT NULL, type INT NOT NULL, resource_id INT NOT NULL, INDEX IDX_34ADA43998FB19AE (sequence_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
  21. Database::query("CREATE TABLE class_item (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(40) DEFAULT NULL, name LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
  22. Database::query("ALTER TABLE sequence_resource ADD CONSTRAINT FK_34ADA43998FB19AE FOREIGN KEY (sequence_id) REFERENCES sequence (id)");
  23. Database::query("DROP INDEX access_cours_code ON track_e_lastaccess");
  24. Database::query("ALTER TABLE track_e_lastaccess DROP access_cours_code, CHANGE access_user_id access_user_id INT DEFAULT NULL, CHANGE access_date access_date DATETIME NOT NULL, CHANGE access_session_id access_session_id INT DEFAULT NULL");
  25. Database::query("CREATE INDEX access_c_id ON track_e_lastaccess (c_id)");
  26. Database::query("ALTER TABLE access_url ADD url_type TINYINT(1) DEFAULT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE active active INT NOT NULL, CHANGE tms tms DATETIME NOT NULL");
  27. Database::query("ALTER TABLE access_url ENGINE=InnoDB");
  28. Database::query("ALTER TABLE session_category CHANGE access_url_id access_url_id INT DEFAULT NULL");
  29. Database::query("ALTER TABLE session_category ENGINE=InnoDB");
  30. Database::query("ALTER TABLE session_category ADD CONSTRAINT FK_8DE079A973444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id)");
  31. Database::query("CREATE INDEX IDX_8DE079A973444FD5 ON session_category (access_url_id)");
  32. Database::query("ALTER TABLE user CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE username username VARCHAR(100) NOT NULL, CHANGE auth_source auth_source VARCHAR(50) DEFAULT NULL, CHANGE email email VARCHAR(100) NOT NULL, CHANGE status status INT NOT NULL, CHANGE creator_id creator_id INT DEFAULT NULL, CHANGE chatcall_user_id chatcall_user_id INT DEFAULT NULL, CHANGE active active TINYINT(1) NOT NULL, CHANGE hr_dept_id hr_dept_id SMALLINT DEFAULT NULL");
  33. Database::query("CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON user (username_canonical)");
  34. Database::query("DROP INDEX username ON user");
  35. Database::query("CREATE UNIQUE INDEX UNIQ_8D93D649F85E0677 ON user (username)");
  36. Database::query("ALTER TABLE user ENGINE=InnoDB");
  37. Database::query("ALTER TABLE session DROP date_start, DROP date_end, DROP nb_days_access_before_beginning, DROP nb_days_access_after_end, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE id_coach id_coach INT DEFAULT NULL, CHANGE name name VARCHAR(150) NOT NULL, CHANGE nbr_courses nbr_courses SMALLINT DEFAULT NULL, CHANGE nbr_users nbr_users INT DEFAULT NULL, CHANGE nbr_classes nbr_classes INT DEFAULT NULL, CHANGE session_admin_id session_admin_id INT DEFAULT NULL, CHANGE visibility visibility INT NOT NULL, CHANGE session_category_id session_category_id INT DEFAULT NULL, CHANGE promotion_id promotion_id INT DEFAULT NULL, CHANGE description description LONGTEXT DEFAULT NULL, CHANGE show_description show_description TINYINT(1) DEFAULT NULL");
  38. Database::query("ALTER TABLE session ENGINE=InnoDB");
  39. Database::query("UPDATE session SET id_coach = NULL WHERE id_coach = 0");
  40. Database::query("UPDATE session SET session_category_id = NULL WHERE session_category_id = 0");
  41. Database::query("ALTER TABLE session ADD CONSTRAINT FK_D044D5D4D1DC2CFC FOREIGN KEY (id_coach) REFERENCES user (id)");
  42. Database::query("ALTER TABLE session ADD CONSTRAINT FK_D044D5D4EE1F8395 FOREIGN KEY (session_category_id) REFERENCES session_category (id)");
  43. Database::query("ALTER TABLE session_rel_user ADD moved_status INT DEFAULT NULL, ADD moved_at DATETIME DEFAULT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE session_id session_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE relation_type relation_type INT NOT NULL");
  44. Database::query("ALTER TABLE session_rel_user ENGINE=InnoDB");
  45. Database::query("ALTER TABLE session_rel_user ADD CONSTRAINT FK_B0D7D4C0613FECDF FOREIGN KEY (session_id) REFERENCES session (id)");
  46. Database::query("ALTER TABLE session_rel_user ADD CONSTRAINT FK_B0D7D4C0A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
  47. Database::query("CREATE INDEX IDX_B0D7D4C0613FECDF ON session_rel_user (session_id)");
  48. Database::query("CREATE INDEX IDX_B0D7D4C0A76ED395 ON session_rel_user (user_id)");
  49. Database::query("CREATE INDEX idx_session_rel_user_id_user_moved ON session_rel_user (user_id, moved_to)");
  50. Database::query("ALTER TABLE sequence_rule CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE description description LONGTEXT NOT NULL");
  51. Database::query("ALTER TABLE specific_field CHANGE code code VARCHAR(1) NOT NULL");
  52. Database::query("ALTER TABLE sequence_type_entity CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE description description LONGTEXT NOT NULL, CHANGE ent_table ent_table VARCHAR(255) NOT NULL");
  53. Database::query("ALTER TABLE sequence_row_entity CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sequence_type_entity_id sequence_type_entity_id INT DEFAULT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE row_id row_id INT NOT NULL, CHANGE name name VARCHAR(255) NOT NULL");
  54. Database::query("ALTER TABLE sequence_row_entity ADD CONSTRAINT FK_2779761FAED14944 FOREIGN KEY (sequence_type_entity_id) REFERENCES sequence_type_entity (id)");
  55. Database::query("CREATE INDEX IDX_2779761FAED14944 ON sequence_row_entity (sequence_type_entity_id)");
  56. Database::query("ALTER TABLE track_e_attempt_coeff CHANGE id id INT AUTO_INCREMENT NOT NULL");
  57. Database::query("ALTER TABLE sequence_value CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE sequence_row_entity_id sequence_row_entity_id INT DEFAULT NULL, CHANGE advance advance DOUBLE PRECISION NOT NULL, CHANGE complete_items complete_items INT NOT NULL, CHANGE total_items total_items INT NOT NULL, CHANGE success success TINYINT(1) NOT NULL, CHANGE success_date success_date DATETIME DEFAULT NULL, CHANGE available available TINYINT(1) NOT NULL, CHANGE available_start_date available_start_date DATETIME DEFAULT NULL, CHANGE available_end_date available_end_date DATETIME DEFAULT NULL");
  58. Database::query("ALTER TABLE sequence_value ADD CONSTRAINT FK_66FBF12D218736B2 FOREIGN KEY (sequence_row_entity_id) REFERENCES sequence_row_entity (id)");
  59. Database::query("CREATE INDEX IDX_66FBF12D218736B2 ON sequence_value (sequence_row_entity_id)");
  60. Database::query("ALTER TABLE notification CHANGE dest_mail dest_mail VARCHAR(255) DEFAULT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL, CHANGE content content VARCHAR(255) DEFAULT NULL, CHANGE send_freq send_freq SMALLINT DEFAULT NULL");
  61. Database::query("ALTER TABLE settings_current CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE title title VARCHAR(255) NOT NULL, CHANGE access_url access_url INT DEFAULT 1 NOT NULL, CHANGE access_url_changeable access_url_changeable INT NOT NULL");
  62. Database::query("ALTER TABLE settings_current ENGINE=InnoDB");
  63. Database::query("CREATE UNIQUE INDEX unique_setting ON settings_current (variable, subkey, access_url)");
  64. Database::query("ALTER TABLE gradebook_evaluation CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE max max DOUBLE PRECISION NOT NULL, CHANGE type type VARCHAR(40) NOT NULL, CHANGE locked locked INT NOT NULL");
  65. Database::query("ALTER TABLE track_e_attempt_recording CHANGE exe_id exe_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE insert_date insert_date DATETIME NOT NULL, CHANGE author author INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  66. Database::query("ALTER TABLE shared_survey_question CHANGE survey_id survey_id INT NOT NULL, CHANGE type type VARCHAR(250) NOT NULL, CHANGE display display VARCHAR(10) NOT NULL, CHANGE sort sort INT NOT NULL, CHANGE code code VARCHAR(40) NOT NULL");
  67. Database::query("ALTER TABLE user_friend_relation_type CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE title title VARCHAR(20) DEFAULT NULL");
  68. Database::query("ALTER TABLE user_api_key CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE api_key api_key VARCHAR(32) NOT NULL, CHANGE api_service api_service VARCHAR(10) NOT NULL");
  69. Database::query("ALTER TABLE sequence_variable CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE name name VARCHAR(255) DEFAULT NULL, CHANGE default_val default_val VARCHAR(255) DEFAULT NULL");
  70. Database::query("ALTER TABLE sequence_condition CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE description description LONGTEXT NOT NULL, CHANGE mat_op mat_op INT NOT NULL, CHANGE act_true act_true INT NOT NULL, CHANGE act_false act_false INT NOT NULL");
  71. Database::query("ALTER TABLE course_module CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE row row INT NOT NULL, CHANGE `column` `column` INT NOT NULL, CHANGE position position VARCHAR(20) NOT NULL");
  72. Database::query("ALTER TABLE course DROP db_name, CHANGE visibility visibility INT DEFAULT NULL, CHANGE show_score show_score INT DEFAULT NULL, CHANGE disk_quota disk_quota BIGINT DEFAULT NULL, CHANGE subscribe subscribe TINYINT(1) DEFAULT NULL, CHANGE unsubscribe unsubscribe TINYINT(1) DEFAULT NULL, CHANGE registration_code registration_code VARCHAR(255) DEFAULT NULL, CHANGE legal legal LONGTEXT DEFAULT NULL, CHANGE activate_legal activate_legal INT DEFAULT NULL, CHANGE course_type_id course_type_id INT DEFAULT NULL, CHANGE add_teachers_to_sessions_courses add_teachers_to_sessions_courses TINYINT(1) DEFAULT NULL");
  73. Database::query("ALTER TABLE course ENGINE=InnoDB");
  74. Database::query("ALTER TABLE course ADD CONSTRAINT FK_169E6FB954177093 FOREIGN KEY (room_id) REFERENCES room (id)");
  75. Database::query("DROP INDEX code ON course");
  76. Database::query("CREATE UNIQUE INDEX UNIQ_169E6FB977153098 ON course (code)");
  77. Database::query("DROP INDEX idx_course_category_code ON course");
  78. Database::query("CREATE INDEX category_code ON course (category_code)");
  79. Database::query("DROP INDEX idx_course_directory ON course");
  80. Database::query("CREATE INDEX directory ON course (directory)");
  81. Database::query("DROP INDEX access_cours_code ON track_e_access");
  82. Database::query("ALTER TABLE track_e_access DROP access_cours_code, CHANGE access_user_id access_user_id INT DEFAULT NULL, CHANGE access_date access_date DATETIME NOT NULL, CHANGE access_session_id access_session_id INT NOT NULL, CHANGE user_ip user_ip VARCHAR(39) NOT NULL");
  83. Database::query("CREATE INDEX access_c_id ON track_e_access (c_id)");
  84. Database::query("ALTER TABLE personal_agenda_repeat CHANGE cal_id cal_id INT AUTO_INCREMENT NOT NULL, CHANGE cal_frequency cal_frequency INT DEFAULT NULL, CHANGE cal_days cal_days VARCHAR(7) DEFAULT NULL");
  85. Database::query("ALTER TABLE track_e_open CHANGE open_date open_date DATETIME NOT NULL");
  86. Database::query("ALTER TABLE chat_video CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE from_user from_user INT NOT NULL, CHANGE to_user to_user INT NOT NULL");
  87. Database::query("ALTER TABLE usergroup_rel_question CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE usergroup_id usergroup_id INT NOT NULL");
  88. Database::query("ALTER TABLE track_e_default DROP default_cours_code, CHANGE default_user_id default_user_id INT NOT NULL, CHANGE default_date default_date DATETIME NOT NULL, CHANGE c_id c_id INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  89. Database::query("CREATE INDEX course ON track_e_default (c_id)");
  90. Database::query("CREATE INDEX session ON track_e_default (session_id)");
  91. Database::query("ALTER TABLE class_user CHANGE class_id class_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL");
  92. Database::query("ALTER TABLE course_type CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE translation_var translation_var VARCHAR(40) DEFAULT NULL");
  93. Database::query("ALTER TABLE access_url_rel_usergroup CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE access_url_id access_url_id INT NOT NULL, CHANGE usergroup_id usergroup_id INT NOT NULL");
  94. Database::query("ALTER TABLE extra_field_values CHANGE field_id field_id INT DEFAULT NULL");
  95. Database::query("ALTER TABLE extra_field_values ADD CONSTRAINT FK_171DF924443707B0 FOREIGN KEY (field_id) REFERENCES extra_field (id)");
  96. Database::query("CREATE INDEX IDX_171DF924443707B0 ON extra_field_values (field_id)");
  97. Database::query("ALTER TABLE course_rel_class CHANGE course_code course_code VARCHAR(40) NOT NULL, CHANGE class_id class_id INT NOT NULL");
  98. Database::query("ALTER TABLE legal CHANGE legal_id legal_id INT NOT NULL, CHANGE date date INT NOT NULL");
  99. Database::query("DROP INDEX exe_cours_id ON track_e_exercises");
  100. Database::query("ALTER TABLE track_e_exercises DROP exe_cours_id, CHANGE exe_user_id exe_user_id INT DEFAULT NULL, CHANGE exe_date exe_date DATETIME NOT NULL, CHANGE exe_exo_id exe_exo_id INT NOT NULL, CHANGE exe_result exe_result DOUBLE PRECISION NOT NULL, CHANGE exe_weighting exe_weighting DOUBLE PRECISION NOT NULL, CHANGE status status VARCHAR(20) NOT NULL, CHANGE start_date start_date DATETIME NOT NULL, CHANGE steps_counter steps_counter SMALLINT NOT NULL, CHANGE session_id session_id SMALLINT NOT NULL, CHANGE orig_lp_id orig_lp_id INT NOT NULL, CHANGE orig_lp_item_id orig_lp_item_id INT NOT NULL, CHANGE exe_duration exe_duration INT NOT NULL, CHANGE expired_time_control expired_time_control DATETIME NOT NULL, CHANGE orig_lp_item_view_id orig_lp_item_view_id INT NOT NULL, CHANGE user_ip user_ip VARCHAR(39) NOT NULL");
  101. Database::query("CREATE INDEX idx_tee_c_id ON track_e_exercises (c_id)");
  102. Database::query("DROP INDEX exe_user_id ON track_e_exercises");
  103. Database::query("CREATE INDEX idx_tee_user_id ON track_e_exercises (exe_user_id)");
  104. Database::query("ALTER TABLE gradebook_result_log CHANGE created_at created_at DATETIME NOT NULL, CHANGE score score DOUBLE PRECISION DEFAULT NULL");
  105. Database::query("ALTER TABLE sequence_method ADD act_false INT NOT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE description description LONGTEXT NOT NULL, CHANGE formula formula LONGTEXT NOT NULL, CHANGE assign assign INT NOT NULL, CHANGE met_type met_type INT NOT NULL");
  106. Database::query("DROP INDEX exe_cours_id ON track_e_hotpotatoes");
  107. Database::query("ALTER TABLE track_e_hotpotatoes DROP exe_cours_id, CHANGE exe_user_id exe_user_id INT DEFAULT NULL, CHANGE exe_date exe_date DATETIME NOT NULL, CHANGE exe_result exe_result SMALLINT NOT NULL, CHANGE exe_weighting exe_weighting SMALLINT NOT NULL");
  108. Database::query("CREATE INDEX idx_tehp_c_id ON track_e_hotpotatoes (c_id)");
  109. Database::query("DROP INDEX exe_user_id ON track_e_hotpotatoes");
  110. Database::query("CREATE INDEX idx_tehp_user_id ON track_e_hotpotatoes (exe_user_id)");
  111. Database::query("ALTER TABLE usergroup ENGINE=InnoDB");
  112. Database::query("ALTER TABLE usergroup_rel_user CHANGE usergroup_id usergroup_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE relation_type relation_type INT NOT NULL");
  113. Database::query("ALTER TABLE usergroup_rel_user ENGINE=InnoDB");
  114. Database::query("ALTER TABLE usergroup_rel_user ADD CONSTRAINT FK_739515A9A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
  115. Database::query("ALTER TABLE usergroup_rel_user ADD CONSTRAINT FK_739515A9D2112630 FOREIGN KEY (usergroup_id) REFERENCES usergroup (id)");
  116. Database::query("CREATE INDEX IDX_739515A9A76ED395 ON usergroup_rel_user (user_id)");
  117. Database::query("CREATE INDEX IDX_739515A9D2112630 ON usergroup_rel_user (usergroup_id)");
  118. Database::query("ALTER TABLE track_e_login CHANGE login_user_id login_user_id INT NOT NULL, CHANGE login_date login_date DATETIME NOT NULL, CHANGE user_ip user_ip VARCHAR(39) NOT NULL");
  119. Database::query("ALTER TABLE gradebook_linkeval_log CHANGE created_at created_at DATETIME NOT NULL");
  120. Database::query("ALTER TABLE skill_rel_user CHANGE course_id course_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE acquired_skill_at acquired_skill_at DATETIME NOT NULL");
  121. Database::query("ALTER TABLE hook_event CHANGE id id INT AUTO_INCREMENT NOT NULL");
  122. Database::query("ALTER TABLE access_url_rel_course DROP PRIMARY KEY");
  123. Database::query("ALTER TABLE access_url_rel_course ADD id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, DROP course_code, CHANGE access_url_id access_url_id INT DEFAULT NULL");
  124. Database::query("ALTER TABLE access_url_rel_course ENGINE=InnoDB");
  125. Database::query("ALTER TABLE access_url_rel_course ADD CONSTRAINT FK_8E97FC0891D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
  126. Database::query("ALTER TABLE access_url_rel_course ADD CONSTRAINT FK_8E97FC0873444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id)");
  127. Database::query("CREATE INDEX IDX_8E97FC0891D79BD3 ON access_url_rel_course (c_id)");
  128. Database::query("CREATE INDEX IDX_8E97FC0873444FD5 ON access_url_rel_course (access_url_id)");
  129. Database::query("ALTER TABLE user_course_category CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE user_id user_id INT NOT NULL");
  130. Database::query("ALTER TABLE gradebook_result CHANGE created_at created_at DATETIME NOT NULL, CHANGE score score DOUBLE PRECISION DEFAULT NULL");
  131. Database::query("ALTER TABLE track_course_ranking CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE url_id url_id INT NOT NULL, CHANGE accesses accesses INT NOT NULL, CHANGE total_score total_score INT NOT NULL, CHANGE users users INT NOT NULL");
  132. Database::query("ALTER TABLE course_category CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE name name VARCHAR(100) NOT NULL, CHANGE code code VARCHAR(40) NOT NULL, CHANGE tree_pos tree_pos INT DEFAULT NULL, CHANGE auth_course_child auth_course_child VARCHAR(40) DEFAULT NULL, CHANGE auth_cat_child auth_cat_child VARCHAR(40) DEFAULT NULL");
  133. Database::query("ALTER TABLE gradebook_score_display CHANGE score score DOUBLE PRECISION NOT NULL, CHANGE category_id category_id INT NOT NULL, CHANGE score_color_percent score_color_percent DOUBLE PRECISION NOT NULL");
  134. Database::query("ALTER TABLE track_e_uploads ADD c_id INT DEFAULT NULL, CHANGE upload_user_id upload_user_id INT DEFAULT NULL, CHANGE upload_date upload_date DATETIME NOT NULL, CHANGE upload_cours_id upload_cours_id VARCHAR(40) NOT NULL, CHANGE upload_work_id upload_work_id INT NOT NULL, CHANGE upload_session_id upload_session_id INT NOT NULL");
  135. Database::query("CREATE INDEX course ON track_e_uploads (c_id)");
  136. Database::query("ALTER TABLE gradebook_certificate CHANGE id id BIGINT AUTO_INCREMENT NOT NULL, CHANGE cat_id cat_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE score_certificate score_certificate DOUBLE PRECISION NOT NULL, CHANGE created_at created_at DATETIME NOT NULL");
  137. Database::query("ALTER TABLE personal_agenda CHANGE user user INT DEFAULT NULL, CHANGE all_day all_day INT NOT NULL");
  138. Database::query("ALTER TABLE access_url_rel_session CHANGE access_url_id access_url_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  139. Database::query("ALTER TABLE career CHANGE status status INT NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL");
  140. Database::query("DROP INDEX course_code ON track_e_course_access");
  141. Database::query("ALTER TABLE track_e_course_access DROP course_code, CHANGE login_course_date login_course_date DATETIME NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE user_ip user_ip VARCHAR(39) NOT NULL");
  142. Database::query("CREATE INDEX course ON track_e_course_access (c_id)");
  143. Database::query("ALTER TABLE chat CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sent sent DATETIME NOT NULL, CHANGE recd recd INT NOT NULL");
  144. Database::query("DROP INDEX course_code ON session_rel_course");
  145. Database::query("ALTER TABLE session_rel_course DROP PRIMARY KEY");
  146. Database::query("ALTER TABLE session_rel_course ADD id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, DROP course_code, DROP category, CHANGE session_id session_id INT NOT NULL, CHANGE nbr_users nbr_users INT NOT NULL, CHANGE position position INT NOT NULL, CHANGE c_id c_id INT NOT NULL");
  147. Database::query("ALTER TABLE session_rel_course ENGINE=InnoDB");
  148. Database::query("ALTER TABLE session_rel_course ADD CONSTRAINT FK_12D110D3613FECDF FOREIGN KEY (session_id) REFERENCES session (id)");
  149. Database::query("ALTER TABLE session_rel_course ADD CONSTRAINT FK_12D110D391D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
  150. Database::query("CREATE INDEX IDX_12D110D3613FECDF ON session_rel_course (session_id)");
  151. Database::query("CREATE INDEX idx_session_rel_course_course_id ON session_rel_course (c_id)");
  152. Database::query("DROP INDEX id ON settings_options");
  153. Database::query("ALTER TABLE settings_options CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE display_text display_text VARCHAR(255) NOT NULL");
  154. Database::query("ALTER TABLE settings_options ENGINE=InnoDB");
  155. Database::query("CREATE UNIQUE INDEX unique_setting_option ON settings_options (variable, value)");
  156. Database::query("ALTER TABLE sys_calendar CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE start_date start_date DATETIME NOT NULL, CHANGE end_date end_date DATETIME NOT NULL, CHANGE access_url_id access_url_id INT NOT NULL, CHANGE all_day all_day INT NOT NULL");
  157. Database::query("ALTER TABLE user_rel_course_vote CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE url_id url_id INT NOT NULL, CHANGE vote vote INT NOT NULL");
  158. Database::query("ALTER TABLE hook_call CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE hook_event_id hook_event_id INT NOT NULL, CHANGE hook_observer_id hook_observer_id INT NOT NULL, CHANGE hook_order hook_order INT NOT NULL");
  159. Database::query("ALTER TABLE message_attachment CHANGE size size INT NOT NULL");
  160. Database::query("ALTER TABLE extra_field_rel_tag CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE field_id field_id INT NOT NULL, CHANGE item_id item_id INT NOT NULL, CHANGE tag_id tag_id INT NOT NULL");
  161. Database::query("DROP INDEX idx_frt_field ON extra_field_rel_tag");
  162. Database::query("CREATE INDEX field ON extra_field_rel_tag (field_id)");
  163. Database::query("DROP INDEX idx_frt_item ON extra_field_rel_tag");
  164. Database::query("CREATE INDEX item ON extra_field_rel_tag (item_id)");
  165. Database::query("DROP INDEX idx_frt_tag ON extra_field_rel_tag");
  166. Database::query("CREATE INDEX tag ON extra_field_rel_tag (tag_id)");
  167. Database::query("DROP INDEX idx_frt_field_item_tag ON extra_field_rel_tag");
  168. Database::query("CREATE INDEX field_item_tag ON extra_field_rel_tag (field_id, item_id, tag_id)");
  169. Database::query("ALTER TABLE access_url_rel_user CHANGE access_url_id access_url_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL");
  170. Database::query("ALTER TABLE access_url_rel_user ENGINE=InnoDB");
  171. Database::query("ALTER TABLE access_url_rel_user ADD CONSTRAINT FK_85574263A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
  172. Database::query("ALTER TABLE access_url_rel_user ADD CONSTRAINT FK_8557426373444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id)");
  173. Database::query("ALTER TABLE track_e_item_property CHANGE progress progress INT NOT NULL, CHANGE lastedit_date lastedit_date DATETIME NOT NULL, CHANGE session_id session_id INT NOT NULL");
  174. Database::query("ALTER TABLE promotion CHANGE status status INT NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL");
  175. Database::query("ALTER TABLE shared_survey_question_option CHANGE question_id question_id INT NOT NULL, CHANGE survey_id survey_id INT NOT NULL, CHANGE sort sort INT NOT NULL");
  176. Database::query("ALTER TABLE block CHANGE active active TINYINT(1) NOT NULL");
  177. Database::query("ALTER TABLE sequence_rule_condition CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sequence_rule_id sequence_rule_id INT DEFAULT NULL, CHANGE sequence_condition_id sequence_condition_id INT DEFAULT NULL");
  178. Database::query("ALTER TABLE sequence_rule_condition ADD CONSTRAINT FK_F948EE6A4044CA89 FOREIGN KEY (sequence_rule_id) REFERENCES sequence_rule (id)");
  179. Database::query("ALTER TABLE sequence_rule_condition ADD CONSTRAINT FK_F948EE6A8C0A7083 FOREIGN KEY (sequence_condition_id) REFERENCES sequence_condition (id)");
  180. Database::query("CREATE INDEX IDX_F948EE6A4044CA89 ON sequence_rule_condition (sequence_rule_id)");
  181. Database::query("CREATE INDEX IDX_F948EE6A8C0A7083 ON sequence_rule_condition (sequence_condition_id)");
  182. Database::query("CREATE INDEX IDX_D044D5D4EE1F8395 ON session (session_category_id)");
  183. Database::query("CREATE INDEX idx_id_coach ON session (id_coach)");
  184. Database::query("DROP INDEX session_admin_id ON session");
  185. Database::query("CREATE INDEX idx_id_session_admin_id ON session (session_admin_id)");
  186. Database::query("ALTER TABLE track_e_hotspot ADD c_id INT DEFAULT NULL, CHANGE hotspot_correct hotspot_correct TINYINT(1) NOT NULL");
  187. Database::query("ALTER TABLE system_template CHANGE id id INT AUTO_INCREMENT NOT NULL");
  188. Database::query("ALTER TABLE track_e_attempt CHANGE user_id user_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE marks marks DOUBLE PRECISION NOT NULL, CHANGE course_code course_code VARCHAR(40) NOT NULL, CHANGE position position INT DEFAULT NULL, CHANGE tms tms DATETIME NOT NULL, CHANGE session_id session_id INT NOT NULL");
  189. Database::query("CREATE INDEX course ON track_e_attempt (c_id)");
  190. Database::query("ALTER TABLE sequence_rule_method CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sequence_rule_id sequence_rule_id INT DEFAULT NULL, CHANGE sequence_method_id sequence_method_id INT DEFAULT NULL, CHANGE method_order method_order INT NOT NULL");
  191. Database::query("ALTER TABLE sequence_rule_method ADD CONSTRAINT FK_6336EA764044CA89 FOREIGN KEY (sequence_rule_id) REFERENCES sequence_rule (id)");
  192. Database::query("ALTER TABLE sequence_rule_method ADD CONSTRAINT FK_6336EA76B2D1386E FOREIGN KEY (sequence_method_id) REFERENCES sequence_method (id)");
  193. Database::query("CREATE INDEX IDX_6336EA764044CA89 ON sequence_rule_method (sequence_rule_id)");
  194. Database::query("CREATE INDEX IDX_6336EA76B2D1386E ON sequence_rule_method (sequence_method_id)");
  195. Database::query("DROP INDEX links_cours_id ON track_e_links");
  196. Database::query("ALTER TABLE track_e_links DROP links_cours_id, CHANGE links_user_id links_user_id INT DEFAULT NULL, CHANGE links_date links_date DATETIME NOT NULL, CHANGE links_link_id links_link_id INT NOT NULL, CHANGE links_session_id links_session_id INT NOT NULL");
  197. Database::query("CREATE INDEX idx_tel_c_id ON track_e_links (c_id)");
  198. Database::query("DROP INDEX links_user_id ON track_e_links");
  199. Database::query("CREATE INDEX idx_tel_user_id ON track_e_links (links_user_id)");
  200. Database::query("ALTER TABLE sequence_formula CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sequence_method_id sequence_method_id INT DEFAULT NULL, CHANGE sequence_variable_id sequence_variable_id INT DEFAULT NULL");
  201. Database::query("ALTER TABLE sequence_formula ADD CONSTRAINT FK_533B9159B2D1386E FOREIGN KEY (sequence_method_id) REFERENCES sequence_method (id)");
  202. Database::query("ALTER TABLE sequence_formula ADD CONSTRAINT FK_533B915955C65E08 FOREIGN KEY (sequence_variable_id) REFERENCES sequence_variable (id)");
  203. Database::query("CREATE INDEX IDX_533B9159B2D1386E ON sequence_formula (sequence_method_id)");
  204. Database::query("CREATE INDEX IDX_533B915955C65E08 ON sequence_formula (sequence_variable_id)");
  205. Database::query("ALTER TABLE tag CHANGE tag tag VARCHAR(255) NOT NULL");
  206. Database::query("DROP INDEX course ON track_e_online");
  207. Database::query("ALTER TABLE track_e_online DROP course, CHANGE login_user_id login_user_id INT NOT NULL, CHANGE login_date login_date DATETIME NOT NULL, CHANGE user_ip user_ip VARCHAR(39) NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE access_url_id access_url_id INT NOT NULL");
  208. Database::query("CREATE INDEX course ON track_e_online (c_id)");
  209. Database::query("ALTER TABLE shared_survey CHANGE survey_id survey_id INT AUTO_INCREMENT NOT NULL, CHANGE creation_date creation_date DATETIME NOT NULL, CHANGE course_code course_code VARCHAR(40) NOT NULL");
  210. Database::query("ALTER TABLE course_request CHANGE user_id user_id INT NOT NULL, CHANGE request_date request_date DATETIME NOT NULL, CHANGE status status INT NOT NULL, CHANGE info info INT NOT NULL, CHANGE exemplary_content exemplary_content INT NOT NULL");
  211. Database::query("DROP INDEX course_code ON session_rel_course_rel_user");
  212. Database::query("ALTER TABLE session_rel_course_rel_user DROP PRIMARY KEY");
  213. Database::query("ALTER TABLE session_rel_course_rel_user ADD id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, DROP course_code, CHANGE session_id session_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE visibility visibility INT NOT NULL, CHANGE status status INT NOT NULL, CHANGE legal_agreement legal_agreement INT DEFAULT NULL, CHANGE c_id c_id INT NOT NULL");
  214. Database::query("ALTER TABLE session_rel_course_rel_user ENGINE=InnoDB");
  215. Database::query("ALTER TABLE session_rel_course_rel_user ADD CONSTRAINT FK_720167EA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
  216. Database::query("ALTER TABLE session_rel_course_rel_user ADD CONSTRAINT FK_720167E613FECDF FOREIGN KEY (session_id) REFERENCES session (id)");
  217. Database::query("ALTER TABLE session_rel_course_rel_user ADD CONSTRAINT FK_720167E91D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
  218. Database::query("CREATE INDEX IDX_720167E613FECDF ON session_rel_course_rel_user (session_id)");
  219. Database::query("CREATE INDEX idx_session_rel_course_rel_user_course_id ON session_rel_course_rel_user (c_id)");
  220. //Database::query("DROP INDEX id_user ON session_rel_course_rel_user");
  221. //Database::query("CREATE INDEX idx_session_rel_course_rel_user_id_user ON session_rel_course_rel_user (user_id)");
  222. Database::query("ALTER TABLE sys_announcement CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE date_start date_start DATETIME NOT NULL, CHANGE date_end date_end DATETIME NOT NULL, CHANGE visible_teacher visible_teacher TINYINT(1) NOT NULL, CHANGE visible_student visible_student TINYINT(1) NOT NULL, CHANGE visible_guest visible_guest TINYINT(1) NOT NULL, CHANGE title title VARCHAR(250) NOT NULL, CHANGE access_url_id access_url_id INT NOT NULL");
  223. Database::query("ALTER TABLE user_rel_user CHANGE id id BIGINT AUTO_INCREMENT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE friend_user_id friend_user_id INT NOT NULL, CHANGE relation_type relation_type INT NOT NULL");
  224. Database::query("ALTER TABLE gradebook_score_log CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE category_id category_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL");
  225. Database::query("DROP INDEX down_cours_id ON track_e_downloads");
  226. Database::query("ALTER TABLE track_e_downloads DROP down_cours_id, CHANGE down_user_id down_user_id INT DEFAULT NULL, CHANGE down_date down_date DATETIME NOT NULL, CHANGE down_doc_path down_doc_path VARCHAR(255) NOT NULL, CHANGE down_session_id down_session_id INT NOT NULL");
  227. Database::query("CREATE INDEX idx_ted_c_id ON track_e_downloads (c_id)");
  228. Database::query("DROP INDEX down_user_id ON track_e_downloads");
  229. Database::query("CREATE INDEX idx_ted_user_id ON track_e_downloads (down_user_id)");
  230. Database::query("ALTER TABLE sequence_valid CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE sequence_variable_id sequence_variable_id INT DEFAULT NULL, CHANGE sequence_condition_id sequence_condition_id INT DEFAULT NULL");
  231. Database::query("ALTER TABLE sequence_valid ADD CONSTRAINT FK_F78B9CE655C65E08 FOREIGN KEY (sequence_variable_id) REFERENCES sequence_variable (id)");
  232. Database::query("ALTER TABLE sequence_valid ADD CONSTRAINT FK_F78B9CE68C0A7083 FOREIGN KEY (sequence_condition_id) REFERENCES sequence_condition (id)");
  233. Database::query("CREATE INDEX IDX_F78B9CE655C65E08 ON sequence_valid (sequence_variable_id)");
  234. Database::query("CREATE INDEX IDX_F78B9CE68C0A7083 ON sequence_valid (sequence_condition_id)");
  235. Database::query("ALTER TABLE language CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE available available TINYINT(1) NOT NULL, CHANGE parent_id parent_id TINYINT(1) DEFAULT NULL");
  236. Database::query("ALTER TABLE track_stored_values_stack CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE course_id course_id VARCHAR(40) NOT NULL, CHANGE sv_key sv_key VARCHAR(64) NOT NULL");
  237. Database::query("DROP INDEX user_id ON track_stored_values_stack");
  238. Database::query("CREATE INDEX user_sco_course_sv_stack ON track_stored_values_stack (user_id, sco_id, course_id, sv_key, stack_order)");
  239. Database::query("ALTER TABLE track_stored_values CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE course_id course_id VARCHAR(40) NOT NULL, CHANGE sv_key sv_key VARCHAR(64) NOT NULL");
  240. Database::query("DROP INDEX user_id ON track_stored_values");
  241. Database::query("CREATE INDEX user_sco_course_sv ON track_stored_values (user_id, sco_id, course_id, sv_key)");
  242. Database::query("ALTER TABLE hook_observer CHANGE id id INT AUTO_INCREMENT NOT NULL");
  243. Database::query("ALTER TABLE admin CHANGE user_id user_id INT NOT NULL");
  244. Database::query("ALTER TABLE gradebook_link CHANGE created_at created_at DATETIME NOT NULL, CHANGE locked locked INT NOT NULL");
  245. Database::query("ALTER TABLE message CHANGE id id BIGINT AUTO_INCREMENT NOT NULL, CHANGE user_sender_id user_sender_id INT NOT NULL, CHANGE user_receiver_id user_receiver_id INT NOT NULL, CHANGE msg_status msg_status TINYINT(1) NOT NULL, CHANGE send_date send_date DATETIME NOT NULL, CHANGE group_id group_id INT NOT NULL, CHANGE parent_id parent_id INT NOT NULL, CHANGE update_date update_date DATETIME NOT NULL");
  246. Database::query("ALTER TABLE gradebook_category CHANGE document_id document_id INT DEFAULT NULL, CHANGE locked locked INT NOT NULL, CHANGE grade_model_id grade_model_id INT DEFAULT NULL, CHANGE generate_certificates generate_certificates TINYINT(1) NOT NULL");
  247. Database::query("ALTER TABLE event_email_template CHANGE activated activated TINYINT(1) NOT NULL");
  248. Database::query("ALTER TABLE course_rel_user DROP PRIMARY KEY");
  249. Database::query("ALTER TABLE course_rel_user ADD id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, DROP course_code, DROP role, DROP group_id, CHANGE user_id user_id INT DEFAULT NULL, CHANGE relation_type relation_type INT NOT NULL, CHANGE status status INT NOT NULL, CHANGE is_tutor is_tutor TINYINT(1) DEFAULT NULL, CHANGE user_course_cat user_course_cat INT DEFAULT NULL, CHANGE legal_agreement legal_agreement INT DEFAULT NULL");
  250. Database::query("ALTER TABLE course_rel_user ENGINE=InnoDB");
  251. Database::query("ALTER TABLE course_rel_user ADD CONSTRAINT FK_92CFD9FEA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)");
  252. Database::query("ALTER TABLE course_rel_user ADD CONSTRAINT FK_92CFD9FE91D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
  253. Database::query("CREATE INDEX IDX_92CFD9FE91D79BD3 ON course_rel_user (c_id)");
  254. //Database::query("DROP INDEX user_id ON course_rel_user");
  255. //Database::query("CREATE INDEX IDX_92CFD9FEA76ED395 ON course_rel_user (user_id)");
  256. Database::query("ALTER TABLE c_wiki_discuss CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE publication_id publication_id INT NOT NULL, CHANGE userc_id userc_id INT NOT NULL, CHANGE dtime dtime DATETIME NOT NULL");
  257. Database::query("CREATE INDEX course ON c_wiki_discuss (c_id)");
  258. Database::query("ALTER TABLE c_quiz_question CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE ponderation ponderation DOUBLE PRECISION NOT NULL, CHANGE position position INT NOT NULL, CHANGE type type TINYINT(1) NOT NULL, CHANGE level level INT NOT NULL, CHANGE question_code question_code VARCHAR(10) DEFAULT NULL");
  259. Database::query("CREATE INDEX course ON c_quiz_question (c_id)");
  260. Database::query("ALTER TABLE c_forum_thread CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE thread_id thread_id INT NOT NULL, CHANGE forum_id forum_id INT DEFAULT NULL, CHANGE thread_poster_name thread_poster_name VARCHAR(100) DEFAULT NULL, CHANGE thread_date thread_date DATETIME DEFAULT NULL, CHANGE thread_sticky thread_sticky TINYINT(1) DEFAULT NULL, CHANGE locked locked INT NOT NULL, CHANGE session_id session_id INT DEFAULT NULL, CHANGE thread_title_qualify thread_title_qualify VARCHAR(255) DEFAULT NULL, CHANGE thread_qualify_max thread_qualify_max DOUBLE PRECISION NOT NULL, CHANGE thread_close_date thread_close_date DATETIME DEFAULT NULL, CHANGE thread_weight thread_weight DOUBLE PRECISION NOT NULL, CHANGE thread_peer_qualify thread_peer_qualify TINYINT(1) NOT NULL");
  261. Database::query("CREATE INDEX course ON c_forum_thread (c_id)");
  262. Database::query("ALTER TABLE c_dropbox_person CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE file_id file_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL");
  263. Database::query("CREATE INDEX course ON c_dropbox_person (c_id)");
  264. Database::query("CREATE INDEX user ON c_dropbox_person (user_id)");
  265. Database::query("ALTER TABLE c_announcement_attachment CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE size size INT NOT NULL");
  266. Database::query("CREATE INDEX course ON c_announcement_attachment (c_id)");
  267. Database::query("ALTER TABLE c_online_link CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE name name VARCHAR(50) NOT NULL, CHANGE url url VARCHAR(100) NOT NULL");
  268. Database::query("CREATE INDEX course ON c_online_link (c_id)");
  269. Database::query("ALTER TABLE c_forum_mailcue CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE thread_id thread_id INT NOT NULL, CHANGE post_id post_id INT NOT NULL");
  270. Database::query("CREATE INDEX course ON c_forum_mailcue (c_id)");
  271. Database::query("CREATE INDEX thread ON c_forum_mailcue (thread_id)");
  272. Database::query("CREATE INDEX user ON c_forum_mailcue (user_id)");
  273. Database::query("CREATE INDEX post ON c_forum_mailcue (post_id)");
  274. Database::query("ALTER TABLE c_role CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE role_id role_id INT NOT NULL, CHANGE role_name role_name VARCHAR(250) NOT NULL, CHANGE default_role default_role TINYINT(1) DEFAULT NULL");
  275. Database::query("CREATE INDEX course ON c_role (c_id)");
  276. Database::query("ALTER TABLE c_dropbox_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE cat_id cat_id INT NOT NULL, CHANGE received received TINYINT(1) NOT NULL, CHANGE sent sent TINYINT(1) NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  277. Database::query("CREATE INDEX course ON c_dropbox_category (c_id)");
  278. Database::query("ALTER TABLE c_group_rel_user CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE group_id group_id INT NOT NULL, CHANGE status status INT NOT NULL, CHANGE role role VARCHAR(50) NOT NULL");
  279. Database::query("CREATE INDEX course ON c_group_rel_user (c_id)");
  280. Database::query("ALTER TABLE c_notebook CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE notebook_id notebook_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE creation_date creation_date DATETIME NOT NULL, CHANGE update_date update_date DATETIME NOT NULL");
  281. Database::query("CREATE INDEX course ON c_notebook (c_id)");
  282. Database::query("ALTER TABLE c_group_rel_tutor CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE group_id group_id INT NOT NULL");
  283. Database::query("CREATE INDEX course ON c_group_rel_tutor (c_id)");
  284. Database::query("ALTER TABLE c_document CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE path path VARCHAR(255) NOT NULL, CHANGE filetype filetype VARCHAR(10) NOT NULL, CHANGE size size INT NOT NULL, CHANGE readonly readonly TINYINT(1) NOT NULL, CHANGE session_id session_id INT NOT NULL");
  285. Database::query("CREATE INDEX course ON c_document (c_id)");
  286. Database::query("ALTER TABLE c_lp_item CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE lp_id lp_id INT NOT NULL, CHANGE item_type item_type VARCHAR(32) NOT NULL, CHANGE description description VARCHAR(511) DEFAULT NULL, CHANGE min_score min_score DOUBLE PRECISION NOT NULL, CHANGE max_score max_score DOUBLE PRECISION DEFAULT '100', CHANGE mastery_score mastery_score DOUBLE PRECISION DEFAULT NULL, CHANGE parent_item_id parent_item_id INT NOT NULL, CHANGE previous_item_id previous_item_id INT NOT NULL, CHANGE next_item_id next_item_id INT NOT NULL, CHANGE display_order display_order INT NOT NULL, CHANGE max_time_allowed max_time_allowed VARCHAR(13) DEFAULT NULL");
  287. Database::query("CREATE INDEX course ON c_lp_item (c_id)");
  288. Database::query("ALTER TABLE c_forum_thread_qualify CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE qualify qualify DOUBLE PRECISION NOT NULL, CHANGE qualify_time qualify_time DATETIME DEFAULT NULL");
  289. Database::query("CREATE INDEX course ON c_forum_thread_qualify (c_id)");
  290. Database::query("ALTER TABLE c_blog_comment CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE comment_id comment_id INT NOT NULL, CHANGE title title VARCHAR(250) NOT NULL, CHANGE author_id author_id INT NOT NULL, CHANGE date_creation date_creation DATETIME NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE post_id post_id INT NOT NULL, CHANGE parent_comment_id parent_comment_id INT NOT NULL");
  291. Database::query("CREATE INDEX course ON c_blog_comment (c_id)");
  292. Database::query("ALTER TABLE c_lp_iv_interaction CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE order_id order_id INT NOT NULL, CHANGE lp_iv_id lp_iv_id BIGINT NOT NULL, CHANGE interaction_id interaction_id VARCHAR(255) NOT NULL, CHANGE interaction_type interaction_type VARCHAR(255) NOT NULL, CHANGE weighting weighting DOUBLE PRECISION NOT NULL, CHANGE completion_time completion_time VARCHAR(16) NOT NULL, CHANGE result result VARCHAR(255) NOT NULL, CHANGE latency latency VARCHAR(16) NOT NULL");
  293. Database::query("CREATE INDEX course ON c_lp_iv_interaction (c_id)");
  294. Database::query("ALTER TABLE c_thematic_plan CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL");
  295. Database::query("CREATE INDEX course ON c_thematic_plan (c_id)");
  296. Database::query("ALTER TABLE c_resource CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE source_id source_id INT DEFAULT NULL, CHANGE resource_id resource_id INT DEFAULT NULL");
  297. Database::query("CREATE INDEX course ON c_resource (c_id)");
  298. Database::query("ALTER TABLE c_blog_rel_user CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL");
  299. Database::query("CREATE INDEX course ON c_blog_rel_user (c_id)");
  300. Database::query("ALTER TABLE c_permission_user CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE tool tool VARCHAR(250) NOT NULL, CHANGE action action VARCHAR(250) NOT NULL");
  301. Database::query("CREATE INDEX course ON c_permission_user (c_id)");
  302. Database::query("ALTER TABLE c_wiki_conf CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE page_id page_id INT NOT NULL, CHANGE startdate_assig startdate_assig DATETIME NOT NULL, CHANGE enddate_assig enddate_assig DATETIME NOT NULL, CHANGE delayedsubmit delayedsubmit INT NOT NULL");
  303. Database::query("CREATE INDEX course ON c_wiki_conf (c_id)");
  304. Database::query("ALTER TABLE c_survey_group CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE survey_id survey_id INT NOT NULL");
  305. Database::query("CREATE INDEX course ON c_survey_group (c_id)");
  306. Database::query("ALTER TABLE c_lp CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE lp_type lp_type INT NOT NULL, CHANGE force_commit force_commit TINYINT(1) NOT NULL, CHANGE default_view_mod default_view_mod VARCHAR(32) DEFAULT 'embedded' NOT NULL, CHANGE default_encoding default_encoding VARCHAR(32) DEFAULT 'UTF-8' NOT NULL, CHANGE display_order display_order INT DEFAULT 0 NOT NULL, CHANGE prevent_reinit prevent_reinit TINYINT(1) DEFAULT '1' NOT NULL, CHANGE debug debug TINYINT(1) NOT NULL, CHANGE theme theme VARCHAR(255) NOT NULL, CHANGE preview_image preview_image VARCHAR(255) NOT NULL, CHANGE author author VARCHAR(255) NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE prerequisite prerequisite INT NOT NULL, CHANGE hide_toc_frame hide_toc_frame TINYINT(1) NOT NULL, CHANGE seriousgame_mode seriousgame_mode TINYINT(1) NOT NULL, CHANGE use_max_score use_max_score INT DEFAULT 1 NOT NULL, CHANGE autolaunch autolaunch INT NOT NULL, CHANGE created_on created_on DATETIME NOT NULL, CHANGE modified_on modified_on DATETIME NOT NULL, CHANGE publicated_on publicated_on DATETIME NOT NULL, CHANGE expired_on expired_on DATETIME NOT NULL, CHANGE category_id category_id INT NOT NULL, CHANGE subscribe_users subscribe_users INT NOT NULL");
  307. Database::query("CREATE INDEX course ON c_lp (c_id)");
  308. Database::query("ALTER TABLE c_blog CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE blog_name blog_name VARCHAR(250) NOT NULL, CHANGE date_creation date_creation DATETIME NOT NULL, CHANGE visibility visibility TINYINT(1) NOT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  309. Database::query("CREATE INDEX course ON c_blog (c_id)");
  310. Database::query("ALTER TABLE c_student_publication_rel_user ADD iid INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY (iid)");
  311. Database::query("CREATE INDEX course ON c_student_publication_rel_user (c_id)");
  312. Database::query("CREATE INDEX work ON c_student_publication_rel_user (work_id)");
  313. Database::query("CREATE INDEX user ON c_student_publication_rel_user (user_id)");
  314. Database::query("ALTER TABLE c_announcement CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE display_order display_order INT NOT NULL, CHANGE email_sent email_sent TINYINT(1) DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  315. Database::query("CREATE INDEX course ON c_announcement (c_id)");
  316. Database::query("ALTER TABLE c_chat_connected CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE last_connection last_connection DATETIME NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE to_group_id to_group_id INT NOT NULL");
  317. Database::query("CREATE INDEX course ON c_chat_connected (c_id)");
  318. Database::query("CREATE INDEX user ON c_chat_connected (user_id)");
  319. Database::query("ALTER TABLE c_thematic CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE display_order display_order INT NOT NULL, CHANGE active active TINYINT(1) NOT NULL, CHANGE session_id session_id INT NOT NULL");
  320. Database::query("CREATE INDEX course ON c_thematic (c_id)");
  321. Database::query("ALTER TABLE c_calendar_event_repeat CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE cal_id cal_id INT NOT NULL, CHANGE cal_frequency cal_frequency INT DEFAULT NULL, CHANGE cal_days cal_days VARCHAR(7) DEFAULT NULL");
  322. Database::query("CREATE INDEX course ON c_calendar_event_repeat (c_id)");
  323. Database::query("ALTER TABLE c_permission_task CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE task_id task_id INT NOT NULL, CHANGE tool tool VARCHAR(250) NOT NULL, CHANGE action action VARCHAR(250) NOT NULL");
  324. Database::query("CREATE INDEX course ON c_permission_task (c_id)");
  325. Database::query("ALTER TABLE c_attendance_sheet_log CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE attendance_id attendance_id INT NOT NULL, CHANGE lastedit_date lastedit_date DATETIME NOT NULL, CHANGE lastedit_user_id lastedit_user_id INT NOT NULL");
  326. Database::query("CREATE INDEX course ON c_attendance_sheet_log (c_id)");
  327. Database::query("ALTER TABLE c_quiz CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE type type TINYINT(1) NOT NULL, CHANGE random random INT NOT NULL, CHANGE random_answers random_answers TINYINT(1) NOT NULL, CHANGE active active TINYINT(1) NOT NULL, CHANGE results_disabled results_disabled INT NOT NULL, CHANGE max_attempt max_attempt INT NOT NULL, CHANGE start_time start_time DATETIME NOT NULL, CHANGE end_time end_time DATETIME NOT NULL, CHANGE feedback_type feedback_type INT NOT NULL, CHANGE expired_time expired_time INT NOT NULL, CHANGE session_id session_id INT DEFAULT NULL, CHANGE propagate_neg propagate_neg INT NOT NULL, CHANGE review_answers review_answers INT NOT NULL, CHANGE random_by_category random_by_category INT NOT NULL, CHANGE display_category_name display_category_name INT NOT NULL");
  328. Database::query("CREATE INDEX course ON c_quiz (c_id)");
  329. Database::query("ALTER TABLE c_permission_group CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE group_id group_id INT NOT NULL, CHANGE tool tool VARCHAR(250) NOT NULL, CHANGE action action VARCHAR(250) NOT NULL");
  330. Database::query("CREATE INDEX course ON c_permission_group (c_id)");
  331. Database::query("ALTER TABLE c_calendar_event_attachment CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE size size INT NOT NULL");
  332. Database::query("CREATE INDEX course ON c_calendar_event_attachment (c_id)");
  333. Database::query("ALTER TABLE c_blog_rating CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE rating_id rating_id INT NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE rating_type rating_type VARCHAR(40) NOT NULL, CHANGE item_id item_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE rating rating INT NOT NULL");
  334. Database::query("CREATE INDEX course ON c_blog_rating (c_id)");
  335. Database::query("ALTER TABLE c_item_property CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE tool tool VARCHAR(100) NOT NULL, CHANGE insert_date insert_date DATETIME NOT NULL, CHANGE lastedit_date lastedit_date DATETIME NOT NULL, CHANGE ref ref INT NOT NULL, CHANGE lastedit_type lastedit_type VARCHAR(100) NOT NULL, CHANGE lastedit_user_id lastedit_user_id INT NOT NULL, CHANGE to_group_id to_group_id INT DEFAULT NULL, CHANGE to_user_id to_user_id INT DEFAULT NULL, CHANGE visibility visibility TINYINT(1) NOT NULL");
  336. Database::query("ALTER TABLE c_item_property ENGINE=InnoDB");
  337. Database::query("ALTER TABLE c_group_info CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE category_id category_id INT NOT NULL, CHANGE max_student max_student INT NOT NULL, CHANGE doc_state doc_state TINYINT(1) NOT NULL, CHANGE calendar_state calendar_state TINYINT(1) NOT NULL, CHANGE work_state work_state TINYINT(1) NOT NULL, CHANGE announcements_state announcements_state TINYINT(1) NOT NULL, CHANGE forum_state forum_state TINYINT(1) NOT NULL, CHANGE wiki_state wiki_state TINYINT(1) NOT NULL, CHANGE chat_state chat_state TINYINT(1) NOT NULL, CHANGE self_registration_allowed self_registration_allowed TINYINT(1) NOT NULL, CHANGE self_unregistration_allowed self_unregistration_allowed TINYINT(1) NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE status status TINYINT(1) DEFAULT NULL");
  338. Database::query("CREATE INDEX course ON c_group_info (c_id)");
  339. Database::query("ALTER TABLE c_group_info ENGINE=InnoDB");
  340. Database::query("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18191D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)");
  341. Database::query("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181330D47E9 FOREIGN KEY (to_group_id) REFERENCES c_group_info (iid)");
  342. Database::query("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18129F6EE60 FOREIGN KEY (to_user_id) REFERENCES user (id)");
  343. Database::query("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C1819C859CC3 FOREIGN KEY (insert_user_id) REFERENCES user (id)");
  344. Database::query("ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181613FECDF FOREIGN KEY (session_id) REFERENCES session (id)");
  345. Database::query("ALTER TABLE c_link_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE display_order display_order INT NOT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  346. Database::query("CREATE INDEX course ON c_link_category (c_id)");
  347. Database::query("ALTER TABLE c_group_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE title title VARCHAR(255) NOT NULL, CHANGE doc_state doc_state TINYINT(1) NOT NULL, CHANGE calendar_state calendar_state TINYINT(1) NOT NULL, CHANGE work_state work_state TINYINT(1) NOT NULL, CHANGE announcements_state announcements_state TINYINT(1) NOT NULL, CHANGE forum_state forum_state TINYINT(1) NOT NULL, CHANGE wiki_state wiki_state TINYINT(1) NOT NULL, CHANGE chat_state chat_state TINYINT(1) NOT NULL, CHANGE max_student max_student INT NOT NULL, CHANGE self_reg_allowed self_reg_allowed TINYINT(1) NOT NULL, CHANGE self_unreg_allowed self_unreg_allowed TINYINT(1) NOT NULL, CHANGE groups_per_user groups_per_user INT NOT NULL, CHANGE display_order display_order INT NOT NULL");
  348. Database::query("CREATE INDEX course ON c_group_category (c_id)");
  349. Database::query("ALTER TABLE c_lp_item_view CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE lp_item_id lp_item_id INT NOT NULL, CHANGE lp_view_id lp_view_id INT NOT NULL, CHANGE view_count view_count INT NOT NULL, CHANGE start_time start_time INT NOT NULL, CHANGE total_time total_time INT NOT NULL, CHANGE score score DOUBLE PRECISION NOT NULL, CHANGE status status VARCHAR(32) DEFAULT 'not attempted' NOT NULL, CHANGE max_score max_score VARCHAR(8) DEFAULT NULL");
  350. Database::query("CREATE INDEX course ON c_lp_item_view (c_id)");
  351. Database::query("ALTER TABLE c_survey CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE survey_id survey_id INT NOT NULL, CHANGE is_shared is_shared VARCHAR(1) DEFAULT NULL, CHANGE creation_date creation_date DATETIME NOT NULL, CHANGE anonymous anonymous VARCHAR(10) NOT NULL, CHANGE shuffle shuffle TINYINT(1) NOT NULL, CHANGE one_question_per_page one_question_per_page TINYINT(1) NOT NULL, CHANGE survey_version survey_version VARCHAR(255) NOT NULL, CHANGE parent_id parent_id INT NOT NULL, CHANGE survey_type survey_type INT NOT NULL, CHANGE show_form_profile show_form_profile INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE visible_results visible_results INT DEFAULT NULL");
  352. Database::query("CREATE INDEX course ON c_survey (c_id)");
  353. Database::query("ALTER TABLE c_link CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE category_id category_id INT DEFAULT NULL, CHANGE display_order display_order INT NOT NULL, CHANGE on_homepage on_homepage VARCHAR(10) NOT NULL, CHANGE target target VARCHAR(10) DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  354. Database::query("CREATE INDEX course ON c_link (c_id)");
  355. Database::query("ALTER TABLE c_thematic_advance CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE attendance_id attendance_id INT NOT NULL, CHANGE start_date start_date DATETIME NOT NULL, CHANGE duration duration INT NOT NULL, CHANGE done_advance done_advance TINYINT(1) NOT NULL");
  356. Database::query("ALTER TABLE c_thematic_advance ENGINE=InnoDB");
  357. Database::query("ALTER TABLE c_thematic_advance ADD CONSTRAINT FK_62798E9754177093 FOREIGN KEY (room_id) REFERENCES room (id)");
  358. Database::query("CREATE INDEX course ON c_thematic_advance (c_id)");
  359. Database::query("ALTER TABLE c_online_connected CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE last_connection last_connection DATETIME NOT NULL");
  360. Database::query("CREATE INDEX course ON c_online_connected (c_id)");
  361. Database::query("ALTER TABLE c_student_publication_assignment CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE expires_on expires_on DATETIME DEFAULT NULL, CHANGE ends_on ends_on DATETIME DEFAULT NULL");
  362. Database::query("CREATE INDEX course ON c_student_publication_assignment (c_id)");
  363. Database::query("ALTER TABLE c_calendar_event_repeat_not CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE cal_id cal_id INT NOT NULL");
  364. Database::query("CREATE INDEX course ON c_calendar_event_repeat_not (c_id)");
  365. Database::query("ALTER TABLE c_role_user CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE role_id role_id INT NOT NULL, CHANGE scope scope VARCHAR(20) NOT NULL, CHANGE user_id user_id INT NOT NULL");
  366. Database::query("CREATE INDEX course ON c_role_user (c_id)");
  367. Database::query("CREATE INDEX user ON c_role_user (user_id)");
  368. Database::query("ALTER TABLE c_tool CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE visibility visibility TINYINT(1) DEFAULT NULL, CHANGE added_tool added_tool TINYINT(1) DEFAULT NULL, CHANGE target target VARCHAR(20) NOT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  369. Database::query("CREATE INDEX course ON c_tool (c_id)");
  370. Database::query("ALTER TABLE c_wiki_mailcue CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  371. Database::query("CREATE INDEX course ON c_wiki_mailcue (c_id)");
  372. Database::query("CREATE INDEX user ON c_wiki_mailcue (user_id)");
  373. Database::query("ALTER TABLE c_blog_post CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE post_id post_id INT NOT NULL, CHANGE title title VARCHAR(250) NOT NULL, CHANGE date_creation date_creation DATETIME NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE author_id author_id INT NOT NULL");
  374. Database::query("CREATE INDEX course ON c_blog_post (c_id)");
  375. Database::query("CREATE INDEX course ON c_attendance_calendar_rel_group (c_id)");
  376. Database::query("CREATE INDEX `group` ON c_attendance_calendar_rel_group (group_id)");
  377. Database::query("ALTER TABLE c_wiki CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE page_id page_id INT DEFAULT NULL, CHANGE reflink reflink VARCHAR(255) NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE dtime dtime DATETIME NOT NULL, CHANGE addlock addlock INT NOT NULL, CHANGE editlock editlock INT NOT NULL, CHANGE visibility visibility INT NOT NULL, CHANGE addlock_disc addlock_disc INT NOT NULL, CHANGE visibility_disc visibility_disc INT NOT NULL, CHANGE ratinglock_disc ratinglock_disc INT NOT NULL, CHANGE assignment assignment INT NOT NULL, CHANGE score score INT DEFAULT NULL, CHANGE is_editing is_editing INT NOT NULL, CHANGE time_edit time_edit DATETIME NOT NULL, CHANGE hits hits INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  378. Database::query("CREATE INDEX course ON c_wiki (c_id)");
  379. Database::query("ALTER TABLE c_student_publication_rel_document ADD iid INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY (iid)");
  380. Database::query("CREATE INDEX course ON c_student_publication_rel_document (c_id)");
  381. Database::query("CREATE INDEX work ON c_student_publication_rel_document (work_id)");
  382. Database::query("CREATE INDEX document ON c_student_publication_rel_document (document_id)");
  383. Database::query("ALTER TABLE c_tool_intro CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id VARCHAR(255) NOT NULL, CHANGE session_id session_id INT NOT NULL");
  384. Database::query("CREATE INDEX course ON c_tool_intro (c_id)");
  385. Database::query("ALTER TABLE c_course_description CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL, CHANGE description_type description_type INT NOT NULL, CHANGE progress progress INT NOT NULL");
  386. Database::query("ALTER TABLE c_blog_attachment CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE path path VARCHAR(255) NOT NULL, CHANGE size size INT NOT NULL, CHANGE filename filename VARCHAR(255) NOT NULL, CHANGE comment_id comment_id INT NOT NULL");
  387. Database::query("CREATE INDEX course ON c_blog_attachment (c_id)");
  388. Database::query("ALTER TABLE c_attendance_calendar CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE date_time date_time DATETIME NOT NULL, CHANGE done_attendance done_attendance TINYINT(1) NOT NULL");
  389. Database::query("CREATE INDEX course ON c_attendance_calendar (c_id)");
  390. Database::query("ALTER TABLE c_dropbox_post CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE file_id file_id INT NOT NULL, CHANGE dest_user_id dest_user_id INT NOT NULL, CHANGE feedback_date feedback_date DATETIME NOT NULL, CHANGE cat_id cat_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  391. Database::query("CREATE INDEX course ON c_dropbox_post (c_id)");
  392. Database::query("CREATE INDEX dest_user ON c_dropbox_post (dest_user_id)");
  393. Database::query("ALTER TABLE c_student_publication_comment ADD iid INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY (iid)");
  394. Database::query("CREATE INDEX course ON c_student_publication_comment (c_id)");
  395. Database::query("CREATE INDEX user ON c_student_publication_comment (user_id)");
  396. Database::query("CREATE INDEX work ON c_student_publication_comment (work_id)");
  397. Database::query("ALTER TABLE c_role_group CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE role_id role_id INT NOT NULL, CHANGE scope scope VARCHAR(20) NOT NULL, CHANGE group_id group_id INT NOT NULL");
  398. Database::query("CREATE INDEX course ON c_role_group (c_id)");
  399. Database::query("CREATE INDEX `group` ON c_role_group (group_id)");
  400. Database::query("ALTER TABLE c_forum_post CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE post_id post_id INT NOT NULL, CHANGE thread_id thread_id INT DEFAULT NULL, CHANGE forum_id forum_id INT DEFAULT NULL, CHANGE poster_id poster_id INT DEFAULT NULL, CHANGE poster_name poster_name VARCHAR(100) DEFAULT NULL, CHANGE post_date post_date DATETIME DEFAULT NULL, CHANGE post_notification post_notification TINYINT(1) DEFAULT NULL, CHANGE post_parent_id post_parent_id INT DEFAULT NULL, CHANGE visible visible TINYINT(1) DEFAULT NULL");
  401. Database::query("CREATE INDEX course ON c_forum_post (c_id)");
  402. Database::query("ALTER TABLE c_role_permissions CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE role_id role_id INT NOT NULL, CHANGE tool tool VARCHAR(250) NOT NULL, CHANGE action action VARCHAR(50) NOT NULL, CHANGE default_perm default_perm TINYINT(1) NOT NULL");
  403. Database::query("CREATE INDEX course ON c_role_permissions (c_id)");
  404. Database::query("CREATE INDEX role ON c_role_permissions (role_id)");
  405. Database::query("ALTER TABLE c_dropbox_feedback CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE feedback_id feedback_id INT NOT NULL, CHANGE file_id file_id INT NOT NULL, CHANGE author_user_id author_user_id INT NOT NULL, CHANGE feedback_date feedback_date DATETIME NOT NULL");
  406. Database::query("CREATE INDEX course ON c_dropbox_feedback (c_id)");
  407. Database::query("ALTER TABLE c_dropbox_file CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE uploader_id uploader_id INT NOT NULL, CHANGE filename filename VARCHAR(250) NOT NULL, CHANGE filesize filesize INT NOT NULL, CHANGE title title VARCHAR(250) DEFAULT NULL, CHANGE description description VARCHAR(250) DEFAULT NULL, CHANGE author author VARCHAR(250) DEFAULT NULL, CHANGE upload_date upload_date DATETIME NOT NULL, CHANGE last_upload_date last_upload_date DATETIME NOT NULL, CHANGE cat_id cat_id INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  408. Database::query("CREATE INDEX course ON c_dropbox_file (c_id)");
  409. Database::query("ALTER TABLE c_survey_question_option CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE question_option_id question_option_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE survey_id survey_id INT NOT NULL, CHANGE value value INT NOT NULL");
  410. Database::query("CREATE INDEX course ON c_survey_question_option (c_id)");
  411. Database::query("ALTER TABLE c_attendance CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE active active TINYINT(1) NOT NULL, CHANGE attendance_qualify_max attendance_qualify_max INT NOT NULL, CHANGE attendance_weight attendance_weight DOUBLE PRECISION NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE locked locked INT NOT NULL");
  412. Database::query("CREATE INDEX course ON c_attendance (c_id)");
  413. Database::query("ALTER TABLE c_lp_view CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE lp_id lp_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE view_count view_count INT NOT NULL, CHANGE last_item last_item INT NOT NULL, CHANGE progress progress INT DEFAULT NULL, CHANGE session_id session_id INT NOT NULL");
  414. Database::query("CREATE INDEX course ON c_lp_view (c_id)");
  415. Database::query("ALTER TABLE c_blog_task CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE task_id task_id INT NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE title title VARCHAR(250) NOT NULL, CHANGE color color VARCHAR(10) NOT NULL, CHANGE system_task system_task TINYINT(1) NOT NULL");
  416. Database::query("CREATE INDEX course ON c_blog_task (c_id)");
  417. Database::query("CREATE INDEX course ON c_lp_category (c_id)");
  418. Database::query("ALTER TABLE c_glossary CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE glossary_id glossary_id INT NOT NULL, CHANGE session_id session_id INT DEFAULT NULL");
  419. Database::query("CREATE INDEX course ON c_glossary (c_id)");
  420. Database::query("ALTER TABLE c_survey_question CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE survey_id survey_id INT NOT NULL, CHANGE survey_group_pri survey_group_pri INT NOT NULL, CHANGE survey_group_sec1 survey_group_sec1 INT NOT NULL, CHANGE survey_group_sec2 survey_group_sec2 INT NOT NULL");
  421. Database::query("CREATE INDEX course ON c_survey_question (c_id)");
  422. Database::query("ALTER TABLE c_lp_iv_objective CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE lp_iv_id lp_iv_id BIGINT NOT NULL, CHANGE order_id order_id INT NOT NULL, CHANGE objective_id objective_id VARCHAR(255) NOT NULL, CHANGE score_raw score_raw DOUBLE PRECISION NOT NULL, CHANGE score_max score_max DOUBLE PRECISION NOT NULL, CHANGE score_min score_min DOUBLE PRECISION NOT NULL, CHANGE status status VARCHAR(32) NOT NULL");
  423. Database::query("CREATE INDEX course ON c_lp_iv_objective (c_id)");
  424. Database::query("ALTER TABLE c_survey_invitation CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE survey_invitation_id survey_invitation_id INT NOT NULL, CHANGE answered answered INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  425. Database::query("CREATE INDEX course ON c_survey_invitation (c_id)");
  426. Database::query("ALTER TABLE c_blog_task_rel_user CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE blog_id blog_id INT NOT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE task_id task_id INT NOT NULL, CHANGE target_date target_date DATE NOT NULL");
  427. Database::query("CREATE INDEX course ON c_blog_task_rel_user (c_id)");
  428. Database::query("CREATE INDEX user ON c_blog_task_rel_user (user_id)");
  429. Database::query("CREATE INDEX task ON c_blog_task_rel_user (task_id)");
  430. Database::query("ALTER TABLE c_quiz_question_rel_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL");
  431. Database::query("CREATE INDEX course ON c_quiz_question_rel_category (c_id)");
  432. Database::query("ALTER TABLE c_forum_notification CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE forum_id forum_id INT NOT NULL, CHANGE thread_id thread_id INT NOT NULL, CHANGE post_id post_id INT NOT NULL");
  433. Database::query("CREATE INDEX course ON c_forum_notification (c_id)");
  434. Database::query("CREATE INDEX thread ON c_forum_notification (thread_id)");
  435. Database::query("CREATE INDEX post ON c_forum_notification (post_id)");
  436. Database::query("ALTER TABLE c_forum_thread_qualify_log CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE qualify qualify DOUBLE PRECISION NOT NULL, CHANGE qualify_time qualify_time DATETIME DEFAULT NULL");
  437. Database::query("CREATE INDEX course ON c_forum_thread_qualify_log (c_id)");
  438. Database::query("ALTER TABLE c_quiz_answer CHANGE c_id c_id INT UNSIGNED NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE id_auto id_auto INT UNSIGNED NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE correct correct INT DEFAULT NULL, CHANGE ponderation ponderation DOUBLE PRECISION NOT NULL, CHANGE position position INT NOT NULL, CHANGE answer_code answer_code VARCHAR(10) DEFAULT NULL");
  439. Database::query("CREATE INDEX c_id ON c_quiz_answer (c_id)");
  440. Database::query("ALTER TABLE c_attendance_sheet CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE presence presence TINYINT(1) NOT NULL");
  441. Database::query("CREATE INDEX course ON c_attendance_sheet (c_id)");
  442. Database::query("CREATE INDEX user ON c_attendance_sheet (user_id)");
  443. Database::query("ALTER TABLE c_student_publication CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE accepted accepted TINYINT(1) DEFAULT NULL, CHANGE post_group_id post_group_id INT NOT NULL, CHANGE sent_date sent_date DATETIME DEFAULT NULL, CHANGE filetype filetype VARCHAR(10) NOT NULL, CHANGE has_properties has_properties INT NOT NULL, CHANGE qualification qualification DOUBLE PRECISION NOT NULL, CHANGE date_of_qualification date_of_qualification DATETIME DEFAULT NULL, CHANGE parent_id parent_id INT NOT NULL, CHANGE qualificator_id qualificator_id INT NOT NULL, CHANGE weight weight DOUBLE PRECISION NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE allow_text_assignment allow_text_assignment INT NOT NULL, CHANGE contains_file contains_file INT NOT NULL, CHANGE document_id document_id INT NOT NULL");
  444. Database::query("CREATE INDEX course ON c_student_publication (c_id)");
  445. Database::query("ALTER TABLE c_course_setting CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE variable variable VARCHAR(255) NOT NULL, CHANGE value value VARCHAR(255) DEFAULT NULL, CHANGE title title VARCHAR(255) NOT NULL");
  446. Database::query("CREATE INDEX course ON c_course_setting (c_id)");
  447. Database::query("ALTER TABLE c_quiz_question_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL");
  448. Database::query("CREATE INDEX course ON c_quiz_question_category (c_id)");
  449. Database::query("ALTER TABLE c_userinfo_def CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE title title VARCHAR(80) NOT NULL, CHANGE line_count line_count TINYINT(1) NOT NULL, CHANGE rank rank TINYINT(1) NOT NULL");
  450. Database::query("CREATE INDEX course ON c_userinfo_def (c_id)");
  451. Database::query("ALTER TABLE c_forum_forum CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE forum_id forum_id INT NOT NULL, CHANGE forum_title forum_title VARCHAR(255) NOT NULL, CHANGE forum_threads forum_threads INT DEFAULT NULL, CHANGE forum_posts forum_posts INT DEFAULT NULL, CHANGE forum_last_post forum_last_post INT DEFAULT NULL, CHANGE forum_group_public_private forum_group_public_private VARCHAR(20) DEFAULT NULL, CHANGE locked locked INT NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE forum_image forum_image VARCHAR(255) NOT NULL, CHANGE start_time start_time DATETIME NOT NULL, CHANGE end_time end_time DATETIME NOT NULL");
  452. Database::query("CREATE INDEX course ON c_forum_forum (c_id)");
  453. Database::query("ALTER TABLE c_quiz_question_option CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE position position INT NOT NULL");
  454. Database::query("CREATE INDEX course ON c_quiz_question_option (c_id)");
  455. Database::query("ALTER TABLE c_userinfo_content CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE user_id user_id INT NOT NULL, CHANGE definition_id definition_id INT NOT NULL");
  456. Database::query("CREATE INDEX course ON c_userinfo_content (c_id)");
  457. Database::query("ALTER TABLE c_forum_attachment CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE size size INT NOT NULL");
  458. Database::query("CREATE INDEX course ON c_forum_attachment (c_id)");
  459. Database::query("ALTER TABLE c_quiz_rel_question CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE exercice_id exercice_id INT NOT NULL, CHANGE question_order question_order INT NOT NULL");
  460. Database::query("CREATE INDEX course ON c_quiz_rel_question (c_id)");
  461. Database::query("CREATE INDEX question ON c_quiz_rel_question (question_id)");
  462. Database::query("CREATE INDEX exercice ON c_quiz_rel_question (exercice_id)");
  463. Database::query("ALTER TABLE c_attendance_result CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE score score INT NOT NULL");
  464. Database::query("CREATE INDEX course ON c_attendance_result (c_id)");
  465. Database::query("ALTER TABLE c_forum_category CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE cat_id cat_id INT NOT NULL, CHANGE cat_title cat_title VARCHAR(255) NOT NULL, CHANGE cat_order cat_order INT NOT NULL, CHANGE locked locked INT NOT NULL, CHANGE session_id session_id INT NOT NULL");
  466. Database::query("CREATE INDEX course ON c_forum_category (c_id)");
  467. Database::query("ALTER TABLE c_survey_answer CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE answer_id answer_id INT NOT NULL, CHANGE survey_id survey_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE value value INT NOT NULL");
  468. Database::query("CREATE INDEX course ON c_survey_answer (c_id)");
  469. Database::query("ALTER TABLE c_calendar_event CHANGE iid iid INT AUTO_INCREMENT NOT NULL, CHANGE c_id c_id INT NOT NULL, CHANGE id id INT DEFAULT NULL, CHANGE start_date start_date DATETIME NOT NULL, CHANGE end_date end_date DATETIME NOT NULL, CHANGE session_id session_id INT NOT NULL, CHANGE all_day all_day INT NOT NULL");
  470. Database::query("ALTER TABLE c_calendar_event ENGINE=InnoDB");
  471. Database::query("ALTER TABLE c_calendar_event ADD CONSTRAINT FK_A062258154177093 FOREIGN KEY (room_id) REFERENCES room (id)");
  472. Database::query("CREATE INDEX course ON c_calendar_event (c_id)");
  473. echo "Done!<br>" . PHP_EOL;