<?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 Version20230511120019 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 relation_articles (id INT AUTO_INCREMENT NOT NULL, parent_article_id INT NOT NULL, child_article_id INT NOT NULL, deleted TINYINT(1) NOT NULL, INDEX IDX_98C60BD035D702CC (parent_article_id), INDEX IDX_98C60BD0964B78F7 (child_article_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE relation_articles ADD CONSTRAINT FK_98C60BD035D702CC FOREIGN KEY (parent_article_id) REFERENCES articles (id)');
$this->addSql('ALTER TABLE relation_articles ADD CONSTRAINT FK_98C60BD0964B78F7 FOREIGN KEY (child_article_id) REFERENCES articles (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE relation_articles DROP FOREIGN KEY FK_98C60BD035D702CC');
$this->addSql('ALTER TABLE relation_articles DROP FOREIGN KEY FK_98C60BD0964B78F7');
$this->addSql('DROP TABLE relation_articles');
}
}