migrations/Version20220623184050.php line 1

Open in your IDE?
  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 Version20220623184050 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 theme_theme (theme_source INT NOT NULL, theme_target INT NOT NULL, INDEX IDX_CF576CED8FB24B0F (theme_source), INDEX IDX_CF576CED96571B80 (theme_target), PRIMARY KEY(theme_source, theme_target)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE theme_theme ADD CONSTRAINT FK_CF576CED8FB24B0F FOREIGN KEY (theme_source) REFERENCES theme (id) ON DELETE CASCADE');
  20.         $this->addSql('ALTER TABLE theme_theme ADD CONSTRAINT FK_CF576CED96571B80 FOREIGN KEY (theme_target) REFERENCES theme (id) ON DELETE CASCADE');
  21.         $this->addSql('DROP TABLE subThemes');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('CREATE TABLE subThemes (theme_id INT NOT NULL, subTheme_theme_id INT NOT NULL, INDEX IDX_7492BFCD56A599D8 (subTheme_theme_id), INDEX IDX_7492BFCD59027487 (theme_id), PRIMARY KEY(theme_id, subTheme_theme_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  27.         $this->addSql('ALTER TABLE subThemes ADD CONSTRAINT FK_7492BFCD59027487 FOREIGN KEY (theme_id) REFERENCES theme (id)');
  28.         $this->addSql('ALTER TABLE subThemes ADD CONSTRAINT FK_7492BFCD56A599D8 FOREIGN KEY (subTheme_theme_id) REFERENCES theme (id)');
  29.         $this->addSql('DROP TABLE theme_theme');
  30.     }
  31. }