src/Migrations/Version20220929123048.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220929123048 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE olymp_online_course_override (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, caption VARCHAR(255) NOT NULL, course_id INT DEFAULT NULL, INDEX IDX_343BCDF912469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE olymp_online_course_override ADD CONSTRAINT FK_343BCDF912469DE2 FOREIGN KEY (category_id) REFERENCES olymp_online_category (id)');
  20.         $this->addSql('ALTER TABLE olymp_online_participant ADD course_override_id INT DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE olymp_online_participant ADD CONSTRAINT FK_EC81141772551111 FOREIGN KEY (course_override_id) REFERENCES olymp_online_course_override (id)');
  22.         $this->addSql('CREATE INDEX IDX_EC81141772551111 ON olymp_online_participant (course_override_id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE olymp_online_participant DROP FOREIGN KEY FK_EC81141772551111');
  28.         $this->addSql('ALTER TABLE olymp_online_course_override DROP FOREIGN KEY FK_343BCDF912469DE2');
  29.         $this->addSql('DROP TABLE olymp_online_course_override');
  30.         $this->addSql('DROP INDEX IDX_EC81141772551111 ON olymp_online_participant');
  31.         $this->addSql('ALTER TABLE olymp_online_participant DROP course_override_id');
  32.     }
  33. }