migrations/Version20220627123312.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 Version20220627123312 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('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D2727ACA70');
  19.         $this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D259027487');
  20.         $this->addSql('DROP INDEX IDX_EDC608D2727ACA70 ON subtheme');
  21.         $this->addSql('ALTER TABLE subtheme DROP PRIMARY KEY');
  22.         $this->addSql('ALTER TABLE subtheme CHANGE parent_id subtheme_theme_id INT NOT NULL');
  23.         $this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D29BC1E100 FOREIGN KEY (subtheme_theme_id) REFERENCES theme (id)');
  24.         $this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D259027487 FOREIGN KEY (theme_id) REFERENCES theme (id)');
  25.         $this->addSql('CREATE INDEX IDX_EDC608D29BC1E100 ON subtheme (subtheme_theme_id)');
  26.         $this->addSql('ALTER TABLE subtheme ADD PRIMARY KEY (theme_id, subtheme_theme_id)');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D29BC1E100');
  32.         $this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D259027487');
  33.         $this->addSql('DROP INDEX IDX_EDC608D29BC1E100 ON subtheme');
  34.         $this->addSql('ALTER TABLE subtheme DROP PRIMARY KEY');
  35.         $this->addSql('ALTER TABLE subtheme CHANGE subtheme_theme_id parent_id INT NOT NULL');
  36.         $this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D2727ACA70 FOREIGN KEY (parent_id) REFERENCES theme (id)');
  37.         $this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D259027487 FOREIGN KEY (theme_id) REFERENCES theme (id) ON DELETE CASCADE');
  38.         $this->addSql('CREATE INDEX IDX_EDC608D2727ACA70 ON subtheme (parent_id)');
  39.         $this->addSql('ALTER TABLE subtheme ADD PRIMARY KEY (parent_id, theme_id)');
  40.     }
  41. }