<?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 Version20220623182004 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('CREATE TABLE theme (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE subThemes (theme_id INT NOT NULL, subTheme_theme_id INT NOT NULL, INDEX IDX_7492BFCD59027487 (theme_id), INDEX IDX_7492BFCD56A599D8 (subTheme_theme_id), PRIMARY KEY(theme_id, subTheme_theme_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE subThemes ADD CONSTRAINT FK_7492BFCD59027487 FOREIGN KEY (theme_id) REFERENCES theme (id)');
$this->addSql('ALTER TABLE subThemes ADD CONSTRAINT FK_7492BFCD56A599D8 FOREIGN KEY (subTheme_theme_id) REFERENCES theme (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE subThemes DROP FOREIGN KEY FK_7492BFCD59027487');
$this->addSql('ALTER TABLE subThemes DROP FOREIGN KEY FK_7492BFCD56A599D8');
$this->addSql('DROP TABLE theme');
$this->addSql('DROP TABLE subThemes');
}
}