<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220627123312 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D2727ACA70');
$this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D259027487');
$this->addSql('DROP INDEX IDX_EDC608D2727ACA70 ON subtheme');
$this->addSql('ALTER TABLE subtheme DROP PRIMARY KEY');
$this->addSql('ALTER TABLE subtheme CHANGE parent_id subtheme_theme_id INT NOT NULL');
$this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D29BC1E100 FOREIGN KEY (subtheme_theme_id) REFERENCES theme (id)');
$this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D259027487 FOREIGN KEY (theme_id) REFERENCES theme (id)');
$this->addSql('CREATE INDEX IDX_EDC608D29BC1E100 ON subtheme (subtheme_theme_id)');
$this->addSql('ALTER TABLE subtheme ADD PRIMARY KEY (theme_id, subtheme_theme_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D29BC1E100');
$this->addSql('ALTER TABLE subtheme DROP FOREIGN KEY FK_EDC608D259027487');
$this->addSql('DROP INDEX IDX_EDC608D29BC1E100 ON subtheme');
$this->addSql('ALTER TABLE subtheme DROP PRIMARY KEY');
$this->addSql('ALTER TABLE subtheme CHANGE subtheme_theme_id parent_id INT NOT NULL');
$this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D2727ACA70 FOREIGN KEY (parent_id) REFERENCES theme (id)');
$this->addSql('ALTER TABLE subtheme ADD CONSTRAINT FK_EDC608D259027487 FOREIGN KEY (theme_id) REFERENCES theme (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_EDC608D2727ACA70 ON subtheme (parent_id)');
$this->addSql('ALTER TABLE subtheme ADD PRIMARY KEY (parent_id, theme_id)');
}
}