Version20160907150300.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V111;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. /**
  7. * Class Version20160907150300
  8. * Change tables engine to InnoDB
  9. * @package Application\Migrations\Schema\V111
  10. */
  11. class Version20160907150300 extends AbstractMigrationChamilo
  12. {
  13. private $names = [
  14. 'access_url_rel_session',
  15. 'access_url_rel_user',
  16. 'admin',
  17. 'announcement_rel_group',
  18. 'block',
  19. 'c_announcement',
  20. 'c_announcement_attachment',
  21. 'c_attendance',
  22. 'c_attendance_calendar',
  23. 'c_attendance_result',
  24. 'c_attendance_sheet',
  25. 'c_attendance_sheet_log',
  26. 'c_blog',
  27. 'c_blog_attachment',
  28. 'c_blog_comment',
  29. 'c_blog_post',
  30. 'c_blog_rating',
  31. 'c_blog_rel_user',
  32. 'c_blog_task',
  33. 'c_blog_task_rel_user',
  34. 'c_calendar_event_attachment',
  35. 'c_calendar_event_repeat',
  36. 'c_calendar_event_repeat_not',
  37. 'c_chat_connected',
  38. 'c_course_description',
  39. 'c_course_setting',
  40. 'c_document',
  41. 'c_dropbox_category',
  42. 'c_dropbox_feedback',
  43. 'c_dropbox_file',
  44. 'c_dropbox_person',
  45. 'c_dropbox_post',
  46. 'c_forum_attachment',
  47. 'c_forum_category',
  48. 'c_forum_forum',
  49. 'c_forum_mailcue',
  50. 'c_forum_notification',
  51. 'c_forum_post',
  52. 'c_forum_thread',
  53. 'c_forum_thread_qualify',
  54. 'c_forum_thread_qualify_log',
  55. 'c_glossary',
  56. 'c_group_category',
  57. 'c_group_rel_tutor',
  58. 'c_group_rel_user',
  59. 'c_link',
  60. 'c_link_category',
  61. 'c_lp',
  62. 'c_lp_item',
  63. 'c_lp_item_view',
  64. 'c_lp_iv_interaction',
  65. 'c_lp_iv_objective',
  66. 'c_lp_view',
  67. 'c_notebook',
  68. 'c_online_connected',
  69. 'c_online_link',
  70. 'c_permission_group',
  71. 'c_permission_task',
  72. 'c_permission_user',
  73. 'c_quiz',
  74. 'c_quiz_question_category',
  75. 'c_quiz_question_option',
  76. 'c_quiz_question_rel_category',
  77. 'c_quiz_rel_question',
  78. 'c_resource',
  79. 'c_role',
  80. 'c_role_group',
  81. 'c_role_permissions',
  82. 'c_role_user',
  83. 'c_student_publication',
  84. 'c_student_publication_assignment',
  85. 'c_survey',
  86. 'c_survey_answer',
  87. 'c_survey_group',
  88. 'c_survey_invitation',
  89. 'c_survey_question',
  90. 'c_survey_question_option',
  91. 'c_thematic',
  92. 'c_thematic_plan',
  93. 'c_tool',
  94. 'c_tool_intro',
  95. 'c_userinfo_content',
  96. 'c_userinfo_def',
  97. 'c_wiki',
  98. 'c_wiki_conf',
  99. 'c_wiki_discuss',
  100. 'c_wiki_mailcue',
  101. 'career',
  102. 'chat',
  103. 'class_user',
  104. 'course_category',
  105. 'course_module',
  106. 'course_rel_class',
  107. 'course_request',
  108. 'course_type',
  109. 'event_email_template',
  110. 'event_sent',
  111. 'grade_components',
  112. 'grade_model',
  113. 'gradebook_category',
  114. 'gradebook_certificate',
  115. 'gradebook_evaluation',
  116. 'gradebook_link',
  117. 'gradebook_linkeval_log',
  118. 'gradebook_result',
  119. 'gradebook_result_log',
  120. 'gradebook_score_display',
  121. 'language',
  122. 'legal',
  123. 'message',
  124. 'message_attachment',
  125. 'notification',
  126. 'openid_association',
  127. 'personal_agenda',
  128. 'personal_agenda_repeat',
  129. 'personal_agenda_repeat_not',
  130. 'promotion',
  131. 'search_engine_ref',
  132. 'shared_survey',
  133. 'shared_survey_question',
  134. 'shared_survey_question_option',
  135. 'skill',
  136. 'skill_profile',
  137. 'skill_rel_gradebook',
  138. 'skill_rel_profile',
  139. 'skill_rel_skill',
  140. 'skill_rel_user',
  141. 'specific_field',
  142. 'specific_field_values',
  143. 'sys_announcement',
  144. 'sys_calendar',
  145. 'system_template',
  146. 'tag',
  147. 'templates',
  148. 'track_course_ranking',
  149. 'track_e_access',
  150. 'track_e_attempt',
  151. 'track_e_attempt_coeff',
  152. 'track_e_attempt_recording',
  153. 'track_e_course_access',
  154. 'track_e_default',
  155. 'track_e_downloads',
  156. 'track_e_exercises',
  157. 'track_e_hotpotatoes',
  158. 'track_e_hotspot',
  159. 'track_e_item_property',
  160. 'track_e_lastaccess',
  161. 'track_e_links',
  162. 'track_e_login',
  163. 'track_e_online',
  164. 'track_e_open',
  165. 'track_e_uploads',
  166. 'track_stored_values',
  167. 'track_stored_values_stack',
  168. 'user_api_key',
  169. 'user_course_category',
  170. 'user_friend_relation_type',
  171. 'user_rel_course_vote',
  172. 'user_rel_event_type',
  173. 'user_rel_tag',
  174. 'user_rel_user',
  175. 'usergroup_rel_course',
  176. 'usergroup_rel_question',
  177. 'usergroup_rel_session'
  178. ];
  179. /**
  180. * @param Schema $schema
  181. * @throws \Doctrine\DBAL\DBALException
  182. * @throws \Doctrine\DBAL\Schema\SchemaException
  183. */
  184. public function up(Schema $schema)
  185. {
  186. error_log('Version20160907150300');
  187. foreach ($this->names as $name) {
  188. if (!$schema->hasTable($name)) {
  189. continue;
  190. }
  191. $sql = "ALTER TABLE $name ENGINE=InnoDB";
  192. $this->addSql($sql);
  193. error_log($sql);
  194. }
  195. }
  196. /**
  197. * @param Schema $schema
  198. * @throws \Doctrine\DBAL\DBALException
  199. * @throws \Doctrine\DBAL\Schema\SchemaException
  200. */
  201. public function down(Schema $schema)
  202. {
  203. foreach ($this->names as $name) {
  204. if (!$schema->hasTable($name)) {
  205. continue;
  206. }
  207. $this->addSql("ALTER TABLE $name ENGINE=MyISAM");
  208. }
  209. }
  210. }