Browse Source

Fix double index see #1575

jmontoyaa 8 years ago
parent
commit
076761051b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      app/Migrations/Schema/V111/Version111.php

+ 5 - 1
app/Migrations/Schema/V111/Version111.php

@@ -359,7 +359,11 @@ class Version111 extends AbstractMigrationChamilo
         $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_terms_if_profile_completed', 'true', 'Yes'), ('show_terms_if_profile_completed', 'false', 'No')");
         $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_link_ticket_notification', 'true', 'Yes'), ('show_link_ticket_notification', 'false', 'No')");
 
-        $this->addSql("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)");
+        $table = $schema->getTable('c_quiz_question_rel_category');
+        if (!$table->hasIndex('idx_qqrc_qid')) {
+            $this->addSql("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)");
+        }
+
         $table = $schema->getTable('c_quiz_answer');
         $hasIndex = $table->hasIndex('idx_cqa_q');
         if (!$hasIndex) {