Переглянути джерело

Fix migration error see BT#14506

Julio 6 роки тому
батько
коміт
10de63aa8b
1 змінених файлів з 7 додано та 2 видалено
  1. 7 2
      app/Migrations/Schema/V111/Version20161028123400.php

+ 7 - 2
app/Migrations/Schema/V111/Version20161028123400.php

@@ -33,12 +33,17 @@ class Version20161028123400 extends AbstractMigrationChamilo
 
 
         $table = $schema->getTable('personal_agenda');
         $table = $schema->getTable('personal_agenda');
         if ($table->hasIndex('id')) {
         if ($table->hasIndex('id')) {
+            $this->addSql('ALTER TABLE personal_agenda DROP INDEX id');
+            $this->addSql('ALTER TABLE personal_agenda DROP INDEX idx_personal_agenda_user');
+            $this->addSql('ALTER TABLE personal_agenda DROP INDEX idx_personal_agenda_parent');
             $this->addSql('ALTER TABLE personal_agenda modify id INT NOT NULL');
             $this->addSql('ALTER TABLE personal_agenda modify id INT NOT NULL');
-            $table->dropIndex('id');
             if ($table->hasPrimaryKey()) {
             if ($table->hasPrimaryKey()) {
-                $table->dropPrimaryKey();
+                $this->addSql('ALTER TABLE personal_agenda drop primary key ');
             }
             }
+
             $this->addSql('ALTER TABLE personal_agenda CHANGE id id INT AUTO_INCREMENT NOT NULL PRIMARY KEY');
             $this->addSql('ALTER TABLE personal_agenda CHANGE id id INT AUTO_INCREMENT NOT NULL PRIMARY KEY');
+            $this->addSql('CREATE INDEX idx_personal_agenda_user ON personal_agenda (user)');
+            $this->addSql('CREATE INDEX idx_personal_agenda_parent ON personal_agenda (parent_event_id)');
         }
         }
     }
     }