From 5edacb2c3c1a635c8e57362344bb8bd82f9ea1b3 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 13 Dec 2017 10:10:23 -0500 Subject: [PATCH] WIP: DB: Fix missing queries in migration from 1.10.x - refs #2214 --- .../Schema/V111/Version20160929120000.php | 1 + .../Schema/V111/Version20160930144400.php | 1 + .../Schema/V111/Version20161028123400.php | 1 + .../Schema/V111/Version20170522120000.php | 1 + .../Schema/V111/Version20170608164500.php | 1 + .../Schema/V111/Version20171213092400.php | 58 +++++++++++++++++++ 6 files changed, 63 insertions(+) create mode 100644 app/Migrations/Schema/V111/Version20171213092400.php diff --git a/app/Migrations/Schema/V111/Version20160929120000.php b/app/Migrations/Schema/V111/Version20160929120000.php index ee7772cc04..2820e2224e 100644 --- a/app/Migrations/Schema/V111/Version20160929120000.php +++ b/app/Migrations/Schema/V111/Version20160929120000.php @@ -21,6 +21,7 @@ class Version20160929120000 extends AbstractMigrationChamilo */ public function up(Schema $schema) { + error_log('Version20160929120000'); $this->addSql("ALTER TABLE c_tool ADD INDEX idx_ctool_name (name(20))"); } diff --git a/app/Migrations/Schema/V111/Version20160930144400.php b/app/Migrations/Schema/V111/Version20160930144400.php index ef7886aac6..0abcf66d81 100644 --- a/app/Migrations/Schema/V111/Version20160930144400.php +++ b/app/Migrations/Schema/V111/Version20160930144400.php @@ -18,6 +18,7 @@ class Version20160930144400 extends AbstractMigrationChamilo */ public function up(Schema $schema) { + error_log('Version20160930144400'); $this->addSql(' UPDATE track_e_hotspot h SET h.hotspot_answer_id = ( diff --git a/app/Migrations/Schema/V111/Version20161028123400.php b/app/Migrations/Schema/V111/Version20161028123400.php index ae415edc5e..e4a5e80a5a 100644 --- a/app/Migrations/Schema/V111/Version20161028123400.php +++ b/app/Migrations/Schema/V111/Version20161028123400.php @@ -18,6 +18,7 @@ class Version20161028123400 extends AbstractMigrationChamilo */ public function up(Schema $schema) { + error_log('Version20161028123400'); $iidColumn = $schema ->getTable('c_student_publication_comment') ->getColumn('iid'); diff --git a/app/Migrations/Schema/V111/Version20170522120000.php b/app/Migrations/Schema/V111/Version20170522120000.php index 689d0093c6..73f2da9315 100644 --- a/app/Migrations/Schema/V111/Version20170522120000.php +++ b/app/Migrations/Schema/V111/Version20170522120000.php @@ -20,6 +20,7 @@ class Version20170522120000 extends AbstractMigrationChamilo */ public function up(Schema $schema) { + error_log('Version20170522120000'); $trackEAttempt = $schema->getTable('track_e_attempt'); if ($trackEAttempt->hasColumn('course_code')) { $this->addSql("ALTER TABLE track_e_attempt DROP COLUMN course_code"); diff --git a/app/Migrations/Schema/V111/Version20170608164500.php b/app/Migrations/Schema/V111/Version20170608164500.php index c596fd698f..d28af438cc 100644 --- a/app/Migrations/Schema/V111/Version20170608164500.php +++ b/app/Migrations/Schema/V111/Version20170608164500.php @@ -21,6 +21,7 @@ class Version20170608164500 extends AbstractMigrationChamilo */ public function up(Schema $schema) { + error_log('Version20170608164500'); $schema ->getTable('c_quiz_question') ->getColumn('type') diff --git a/app/Migrations/Schema/V111/Version20171213092400.php b/app/Migrations/Schema/V111/Version20171213092400.php new file mode 100644 index 0000000000..aac6cb594f --- /dev/null +++ b/app/Migrations/Schema/V111/Version20171213092400.php @@ -0,0 +1,58 @@ +getTable('extra_field_values'); + $hasIndex = $table->hasIndex('idx_efv_fiii'); + if (!$hasIndex) { + $this->addSql('CREATE INDEX idx_efv_fiii ON extra_field_values (field_id, item_id)'); + } + $this->addSql('ALTER TABLE language CHANGE parent_id parent_id INT DEFAULT NULL'); + $table = $schema->getTable('c_quiz_answer'); + $hasIndex = $table->hasIndex('idx_cqa_q'); + if (!$hasIndex) { + $this->addSql('CREATE INDEX idx_cqa_q ON c_quiz_answer (question_id)'); + } + $this->addSql('ALTER TABLE c_quiz CHANGE start_time start_time DATETIME DEFAULT NULL'); + $this->addSql('ALTER TABLE c_quiz CHANGE end_time end_time DATETIME DEFAULT NULL'); + } + + /** + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function down(Schema $schema) + { + $table = $schema->getTable('c_quiz_answer'); + $hasIndex = $table->hasIndex('idx_cqa_q'); + if ($hasIndex) { + $this->addSql('DROP INDEX idx_cqa_q ON c_quiz_answer'); + } + $table = $schema->getTable('language'); + $this->addSql('ALTER TABLE language CHANGE parent_id parent_id TINYINT DEFAULT NULL'); + $table = $schema->getTable('extra_field_values'); + $hasIndex = $table->hasIndex('idx_efv_fiii'); + if ($hasIndex) { + $this->addSql('DROP INDEX idx_efv_fiii ON extra_field_values'); + } + } +}