<?php
declare(strict_types=1);
/**
* This file is part of Symfony Keen Template Project.
* (c) 2021 One AM SRL
*/
namespace App\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230628132925 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 article_category (article_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_53A4EDAA7294869C (article_id), INDEX IDX_53A4EDAA12469DE2 (category_id), PRIMARY KEY(article_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE footer_entry (id INT AUTO_INCREMENT NOT NULL, position VARCHAR(255) NOT NULL, call_to_action VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, type VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE article_category ADD CONSTRAINT FK_53A4EDAA7294869C FOREIGN KEY (article_id) REFERENCES article (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE article_category ADD CONSTRAINT FK_53A4EDAA12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE');
$this->addSql('INSERT INTO article_category (article_id, category_id) SELECT id, category_id FROM article');
$this->addSql('ALTER TABLE article DROP FOREIGN KEY FK_23A0E6612469DE2');
$this->addSql('DROP INDEX IDX_23A0E6612469DE2 ON article');
$this->addSql('ALTER TABLE article DROP category_id');
$this->addSql('ALTER TABLE page ADD parent_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620727ACA70 FOREIGN KEY (parent_id) REFERENCES page (id)');
$this->addSql('CREATE INDEX IDX_140AB620727ACA70 ON page (parent_id)');
$this->addSql('ALTER TABLE talk_about_us ADD position INT NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE article_category');
$this->addSql('DROP TABLE footer_entry');
$this->addSql('ALTER TABLE article ADD category_id INT NOT NULL');
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E6612469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('CREATE INDEX IDX_23A0E6612469DE2 ON article (category_id)');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620727ACA70');
$this->addSql('DROP INDEX IDX_140AB620727ACA70 ON page');
$this->addSql('ALTER TABLE page DROP parent_id');
$this->addSql('ALTER TABLE talk_about_us DROP position');
}
}