diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20.php b/src/CoreBundle/Migrations/Schema/V200/Version20.php index a691cbf851..da6dfda0ee 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20.php @@ -379,14 +379,14 @@ class Version20 extends AbstractMigrationChamilo // Rename extra_field field_type and extra_field_type to item_type and value_type, also, the term "value" in exta_field_values.value renamed to field_value $table = $schema->getTable('extra_field'); - if (false === $table->hasColumn('extra_field_type')) { + if ($table->hasColumn('extra_field_type')) { $this->addSql('ALTER TABLE extra_field CHANGE extra_field_type item_type INT NOT NULL'); } - if (false === $table->hasColumn('field_type')) { + if ($table->hasColumn('field_type')) { $this->addSql('ALTER TABLE extra_field CHANGE field_type value_type INT NOT NULL'); } $table = $schema->getTable('extra_field_values'); - if (false === $table->hasColumn('value')) { + if ($table->hasColumn('value')) { $this->addSql('ALTER TABLE extra_field_values CHANGE `value` field_value LONGTEXT DEFAULT NULL'); } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php b/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php index b1f37b172c..5b6cb98f7c 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20181025064351.php @@ -72,6 +72,7 @@ class Version20181025064351 extends AbstractMigrationChamilo $this->addSql('UPDATE gradebook_category SET parent_id = NULL WHERE parent_id = 0'); $this->addSql('DELETE FROM gradebook_category WHERE session_id IS NOT NULL AND session_id NOT IN (SELECT id FROM session)'); + $this->addSql('DELETE FROM gradebook_category WHERE parent_id IS NOT NULL AND parent_id NOT IN (SELECT id FROM gradebook_category)'); if (false === $table->hasForeignKey('FK_96A4C705727ACA70')) { $this->addSql('ALTER TABLE gradebook_category ADD CONSTRAINT FK_96A4C705727ACA70 FOREIGN KEY (parent_id) REFERENCES gradebook_category (id) ON DELETE CASCADE');