Version20151101082200.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V110;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. /**
  7. * Calendar color
  8. */
  9. class Version20151101082200 extends AbstractMigrationChamilo
  10. {
  11. /**
  12. * @param Schema $schema
  13. */
  14. public function up(Schema $schema)
  15. {
  16. $this->addSql("ALTER TABLE access_url ENGINE=InnoDB");
  17. $this->addSql("ALTER TABLE access_url_rel_course ENGINE=InnoDB");
  18. $this->addSql("ALTER TABLE course_rel_user ENGINE=InnoDB");
  19. $this->addSql("ALTER TABLE session_category ENGINE=InnoDB");
  20. $this->addSql("ALTER TABLE settings_current ENGINE=InnoDB");
  21. $this->addSql("ALTER TABLE settings_options ENGINE=InnoDB");
  22. $this->addSql("ALTER TABLE usergroup ENGINE=InnoDB");
  23. $this->addSql("ALTER TABLE usergroup_rel_user ENGINE=InnoDB");
  24. $this->addSql("ALTER TABLE session_rel_course DROP PRIMARY KEY");
  25. $this->addSql("ALTER TABLE session_rel_course_rel_user DROP PRIMARY KEY");
  26. $this->addSql("ALTER TABLE session MODIFY session_category_id INT NULL");
  27. $this->addSql("UPDATE session SET session_category_id = NULL WHERE session_category_id NOT IN (SELECT id FROM session_category)");
  28. $table = $schema->getTable('session_rel_course_rel_user');
  29. if ($table->hasForeignKey('FK_720167E91D79BD3')) {
  30. $this->addSql("ALTER TABLE session_rel_course_rel_user DROP FOREIGN KEY FK_720167E91D79BD3");
  31. }
  32. $table = $schema->getTable('session_rel_course');
  33. if ($table->hasForeignKey('FK_12D110D391D79BD3')) {
  34. $this->addSql("ALTER TABLE session_rel_course DROP FOREIGN KEY FK_12D110D391D79BD3");
  35. }
  36. }
  37. /**
  38. * @param Schema $schema
  39. */
  40. public function down(Schema $schema)
  41. {
  42. }
  43. }