<?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 Version20220730094345 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_flag DROP FOREIGN KEY FK_21469122919FE4E5');
$this->addSql('ALTER TABLE visiting_card_flag DROP FOREIGN KEY FK_21469122EB37EBA0');
$this->addSql('ALTER TABLE visiting_card_flag ADD id INT AUTO_INCREMENT NOT NULL, ADD position DOUBLE PRECISION DEFAULT NULL, CHANGE visiting_card_id visiting_card_id INT DEFAULT NULL, CHANGE flag_id flag_id INT DEFAULT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)');
$this->addSql('ALTER TABLE visiting_card_flag ADD CONSTRAINT FK_21469122919FE4E5 FOREIGN KEY (flag_id) REFERENCES flag (id)');
$this->addSql('ALTER TABLE visiting_card_flag ADD CONSTRAINT FK_21469122EB37EBA0 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_flag MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE visiting_card_flag DROP FOREIGN KEY FK_21469122919FE4E5');
$this->addSql('ALTER TABLE visiting_card_flag DROP FOREIGN KEY FK_21469122EB37EBA0');
$this->addSql('ALTER TABLE visiting_card_flag DROP PRIMARY KEY');
$this->addSql('ALTER TABLE visiting_card_flag DROP id, DROP position, CHANGE flag_id flag_id INT NOT NULL, CHANGE visiting_card_id visiting_card_id INT NOT NULL');
$this->addSql('ALTER TABLE visiting_card_flag ADD CONSTRAINT FK_21469122919FE4E5 FOREIGN KEY (flag_id) REFERENCES flag (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE visiting_card_flag ADD CONSTRAINT FK_21469122EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE visiting_card_flag ADD PRIMARY KEY (visiting_card_id, flag_id)');
}
}