<?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 Version20211130112556 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 blog_category (id INT AUTO_INCREMENT NOT NULL, id_category_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, INDEX IDX_72113DE6A545015 (id_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE blog_category ADD CONSTRAINT FK_72113DE6A545015 FOREIGN KEY (id_category_id) REFERENCES blog_category (id)');
$this->addSql('ALTER TABLE blog_page ADD id_category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE blog_page ADD CONSTRAINT FK_F4DA3AB0A545015 FOREIGN KEY (id_category_id) REFERENCES blog_category (id)');
$this->addSql('CREATE INDEX IDX_F4DA3AB0A545015 ON blog_page (id_category_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE blog_category DROP FOREIGN KEY FK_72113DE6A545015');
$this->addSql('ALTER TABLE blog_page DROP FOREIGN KEY FK_F4DA3AB0A545015');
$this->addSql('DROP TABLE blog_category');
$this->addSql('DROP INDEX IDX_F4DA3AB0A545015 ON blog_page');
$this->addSql('ALTER TABLE blog_page DROP id_category_id');
}
}