Merge remote-tracking branch 'origin/master'

pull/4826/head
Angel Fernando Quiroz Campos 2 years ago
commit cbfa1726fd
  1. 6
      src/CoreBundle/Migrations/Schema/V200/Version20.php
  2. 1
      src/CoreBundle/Migrations/Schema/V200/Version20181025064351.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 // 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'); $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'); $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'); $this->addSql('ALTER TABLE extra_field CHANGE field_type value_type INT NOT NULL');
} }
$table = $schema->getTable('extra_field_values'); $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'); $this->addSql('ALTER TABLE extra_field_values CHANGE `value` field_value LONGTEXT DEFAULT NULL');
} }

@ -72,6 +72,7 @@ class Version20181025064351 extends AbstractMigrationChamilo
$this->addSql('UPDATE gradebook_category SET parent_id = NULL WHERE parent_id = 0'); $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 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')) { 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'); $this->addSql('ALTER TABLE gradebook_category ADD CONSTRAINT FK_96A4C705727ACA70 FOREIGN KEY (parent_id) REFERENCES gradebook_category (id) ON DELETE CASCADE');

Loading…
Cancel
Save