Use table object to remove index and drop FK, to avoid DB error.

pull/2467/head
jmontoyaa 8 years ago
parent 8be45ae84e
commit 26e3a1bee1
  1. 6
      app/Migrations/Schema/V111/Version20161028123400.php

@ -34,8 +34,10 @@ class Version20161028123400 extends AbstractMigrationChamilo
$table = $schema->getTable('personal_agenda');
if ($table->hasIndex('id')) {
$this->addSql('ALTER TABLE personal_agenda modify id INT NOT NULL');
$this->addSql('ALTER TABLE personal_agenda DROP index id');
$this->addSql('ALTER TABLE personal_agenda DROP PRIMARY KEY');
$table->dropIndex('id');
if ($table->hasPrimaryKey()) {
$table->dropPrimaryKey();
}
$this->addSql('ALTER TABLE personal_agenda CHANGE id id INT AUTO_INCREMENT NOT NULL PRIMARY KEY');
}
}

Loading…
Cancel
Save