<?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 Version20220730113439 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 category_sub_category (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, sub_category_id INT DEFAULT NULL, position DOUBLE PRECISION DEFAULT NULL, INDEX IDX_6634D40A12469DE2 (category_id), INDEX IDX_6634D40AF7BFE87C (sub_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE category_sub_category ADD CONSTRAINT FK_6634D40A12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('ALTER TABLE category_sub_category ADD CONSTRAINT FK_6634D40AF7BFE87C FOREIGN KEY (sub_category_id) REFERENCES sub_category (id)');
$this->addSql('ALTER TABLE sub_category DROP FOREIGN KEY FK_BCE3F79812469DE2');
$this->addSql('DROP INDEX IDX_BCE3F79812469DE2 ON sub_category');
$this->addSql('ALTER TABLE sub_category DROP category_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE category_sub_category');
$this->addSql('ALTER TABLE sub_category ADD category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE sub_category ADD CONSTRAINT FK_BCE3F79812469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_BCE3F79812469DE2 ON sub_category (category_id)');
}
}