<?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 Version20210826102149 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE topic_section (`id` INT AUTO_INCREMENT NOT NULL, `category` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:topic_section_category_type)\', `name` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:topic_section_type)\', `visibility` LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', `create_user` VARCHAR(50) NOT NULL, `creation_date` DATETIME NOT NULL, `modified_user` VARCHAR(50) DEFAULT NULL, `modified_date` DATETIME DEFAULT NULL, PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE topic_section_blog (topic_section_id INT NOT NULL, blog_page_id INT NOT NULL, INDEX IDX_1BAE3ADC1D704D50 (topic_section_id), INDEX IDX_1BAE3ADCE0B0DE67 (blog_page_id), PRIMARY KEY(topic_section_id, blog_page_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE topic_section_media_category (topic_section_id INT NOT NULL, media_category_id INT NOT NULL, INDEX IDX_C5E366201D704D50 (topic_section_id), INDEX IDX_C5E36620E52EEF71 (media_category_id), PRIMARY KEY(topic_section_id, media_category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE topic_section_media (topic_section_id INT NOT NULL, media_id INT NOT NULL, INDEX IDX_A4794B21D704D50 (topic_section_id), INDEX IDX_A4794B2EA9FDD75 (media_id), PRIMARY KEY(topic_section_id, media_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE topic_section_blog ADD CONSTRAINT FK_1BAE3ADC1D704D50 FOREIGN KEY (topic_section_id) REFERENCES topic_section (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE topic_section_blog ADD CONSTRAINT FK_1BAE3ADCE0B0DE67 FOREIGN KEY (blog_page_id) REFERENCES blog_page (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE topic_section_media_category ADD CONSTRAINT FK_C5E366201D704D50 FOREIGN KEY (topic_section_id) REFERENCES topic_section (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE topic_section_media_category ADD CONSTRAINT FK_C5E36620E52EEF71 FOREIGN KEY (media_category_id) REFERENCES media_category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE topic_section_media ADD CONSTRAINT FK_A4794B21D704D50 FOREIGN KEY (topic_section_id) REFERENCES topic_section (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE topic_section_media ADD CONSTRAINT FK_A4794B2EA9FDD75 FOREIGN KEY (media_id) REFERENCES media (id) ON DELETE CASCADE');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE topic_section');
$this->addSql('DROP TABLE topic_section_blog');
$this->addSql('DROP TABLE topic_section_media_category');
$this->addSql('DROP TABLE topic_section_media');
}
}