<?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 Version20220730095859 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('ALTER TABLE visiting_card_tag DROP FOREIGN KEY FK_BE604B13BAD26311');
$this->addSql('ALTER TABLE visiting_card_tag DROP FOREIGN KEY FK_BE604B13EB37EBA0');
$this->addSql('ALTER TABLE visiting_card_tag ADD id INT AUTO_INCREMENT NOT NULL, ADD position DOUBLE PRECISION DEFAULT NULL, CHANGE visiting_card_id visiting_card_id INT DEFAULT NULL, CHANGE tag_id tag_id INT DEFAULT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)');
$this->addSql('ALTER TABLE visiting_card_tag ADD CONSTRAINT FK_BE604B13BAD26311 FOREIGN KEY (tag_id) REFERENCES tag (id)');
$this->addSql('ALTER TABLE visiting_card_tag ADD CONSTRAINT FK_BE604B13EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE visiting_card_tag MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE visiting_card_tag DROP FOREIGN KEY FK_BE604B13BAD26311');
$this->addSql('ALTER TABLE visiting_card_tag DROP FOREIGN KEY FK_BE604B13EB37EBA0');
$this->addSql('ALTER TABLE visiting_card_tag DROP PRIMARY KEY');
$this->addSql('ALTER TABLE visiting_card_tag DROP id, DROP position, CHANGE tag_id tag_id INT NOT NULL, CHANGE visiting_card_id visiting_card_id INT NOT NULL');
$this->addSql('ALTER TABLE visiting_card_tag ADD CONSTRAINT FK_BE604B13BAD26311 FOREIGN KEY (tag_id) REFERENCES tag (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE visiting_card_tag ADD CONSTRAINT FK_BE604B13EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE visiting_card_tag ADD PRIMARY KEY (visiting_card_id, tag_id)');
}
}