<?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 Version20220801182129 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 sub_category_visiting_card (id INT AUTO_INCREMENT NOT NULL, sub_category_id INT DEFAULT NULL, visiting_card_id INT DEFAULT NULL, position DOUBLE PRECISION DEFAULT NULL, INDEX IDX_BF9379CDF7BFE87C (sub_category_id), INDEX IDX_BF9379CDEB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE sub_category_visiting_card ADD CONSTRAINT FK_BF9379CDF7BFE87C FOREIGN KEY (sub_category_id) REFERENCES sub_category (id)');
$this->addSql('ALTER TABLE sub_category_visiting_card ADD CONSTRAINT FK_BF9379CDEB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE visiting_card DROP FOREIGN KEY FK_CB2C96CCF7BFE87C');
$this->addSql('DROP INDEX IDX_CB2C96CCF7BFE87C ON visiting_card');
$this->addSql('ALTER TABLE visiting_card DROP sub_category_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE sub_category_visiting_card');
$this->addSql('ALTER TABLE visiting_card ADD sub_category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE visiting_card ADD CONSTRAINT FK_CB2C96CCF7BFE87C FOREIGN KEY (sub_category_id) REFERENCES sub_category (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_CB2C96CCF7BFE87C ON visiting_card (sub_category_id)');
}
}