migrations/Version20221111131501.php line 1
<?phpdeclare(strict_types=1);namespace DoctrineMigrations;use Doctrine\DBAL\Schema\Schema;use Doctrine\Migrations\AbstractMigration;/*** Auto-generated Migration: Please modify to your needs!*/final class Version20221111131501 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 wiki_post (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, status VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');$this->addSql('CREATE TABLE wiki_post_category (category_id INT NOT NULL, post_id INT NOT NULL, INDEX IDX_CD92DF8D12469DE2 (category_id), INDEX IDX_CD92DF8D4B89032C (post_id), PRIMARY KEY(category_id, post_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');$this->addSql('CREATE TABLE wiki_post_tag (tag_id INT NOT NULL, post_id INT NOT NULL, INDEX IDX_B1083F3FBAD26311 (tag_id), INDEX IDX_B1083F3F4B89032C (post_id), PRIMARY KEY(tag_id, post_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');$this->addSql('CREATE TABLE wiki_tag (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');$this->addSql('ALTER TABLE wiki_post_category ADD CONSTRAINT FK_CD92DF8D12469DE2 FOREIGN KEY (category_id) REFERENCES wiki_post (id)');$this->addSql('ALTER TABLE wiki_post_category ADD CONSTRAINT FK_CD92DF8D4B89032C FOREIGN KEY (post_id) REFERENCES wiki_category (id)');$this->addSql('ALTER TABLE wiki_post_tag ADD CONSTRAINT FK_B1083F3FBAD26311 FOREIGN KEY (tag_id) REFERENCES wiki_post (id)');$this->addSql('ALTER TABLE wiki_post_tag ADD CONSTRAINT FK_B1083F3F4B89032C FOREIGN KEY (post_id) REFERENCES wiki_tag (id)');}public function down(Schema $schema): void{// this down() migration is auto-generated, please modify it to your needs$this->addSql('ALTER TABLE wiki_post_category DROP FOREIGN KEY FK_CD92DF8D12469DE2');$this->addSql('ALTER TABLE wiki_post_tag DROP FOREIGN KEY FK_B1083F3FBAD26311');$this->addSql('ALTER TABLE wiki_post_tag DROP FOREIGN KEY FK_B1083F3F4B89032C');$this->addSql('DROP TABLE wiki_post');$this->addSql('DROP TABLE wiki_post_category');$this->addSql('DROP TABLE wiki_post_tag');$this->addSql('DROP TABLE wiki_tag');}}