migrations/Version20221227102114.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 Version20221227102114 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_comment (id INT AUTO_INCREMENT NOT NULL, author_id INT DEFAULT NULL, post_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, comment LONGTEXT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_5C47A2A9F675F31B (author_id), INDEX IDX_5C47A2A94B89032C (post_id), INDEX IDX_5C47A2A9727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');$this->addSql('ALTER TABLE wiki_comment ADD CONSTRAINT FK_5C47A2A9F675F31B FOREIGN KEY (author_id) REFERENCES user (id)');$this->addSql('ALTER TABLE wiki_comment ADD CONSTRAINT FK_5C47A2A94B89032C FOREIGN KEY (post_id) REFERENCES wiki_post (id)');$this->addSql('ALTER TABLE wiki_comment ADD CONSTRAINT FK_5C47A2A9727ACA70 FOREIGN KEY (parent_id) REFERENCES wiki_comment (id)');$this->addSql('ALTER TABLE wiki_post ADD comment_count INT DEFAULT 0 NOT NULL');}public function down(Schema $schema): void{// this down() migration is auto-generated, please modify it to your needs$this->addSql('ALTER TABLE wiki_comment DROP FOREIGN KEY FK_5C47A2A9F675F31B');$this->addSql('ALTER TABLE wiki_comment DROP FOREIGN KEY FK_5C47A2A94B89032C');$this->addSql('ALTER TABLE wiki_comment DROP FOREIGN KEY FK_5C47A2A9727ACA70');$this->addSql('DROP TABLE wiki_comment');$this->addSql('ALTER TABLE wiki_post DROP comment_count');}}