<?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 Version20220730084859 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE visiting_card_pictogram DROP FOREIGN KEY FK_A0B369B116B7C33B');
$this->addSql('ALTER TABLE visiting_card_pictogram DROP FOREIGN KEY FK_A0B369B1EB37EBA0');
$this->addSql('ALTER TABLE visiting_card_pictogram ADD id INT AUTO_INCREMENT NOT NULL, ADD position DOUBLE PRECISION DEFAULT NULL, CHANGE visiting_card_id visiting_card_id INT DEFAULT NULL, CHANGE pictogram_id pictogram_id INT DEFAULT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)');
$this->addSql('ALTER TABLE visiting_card_pictogram ADD CONSTRAINT FK_A0B369B116B7C33B FOREIGN KEY (pictogram_id) REFERENCES pictogram (id)');
$this->addSql('ALTER TABLE visiting_card_pictogram ADD CONSTRAINT FK_A0B369B1EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE visiting_card_pictogram MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE visiting_card_pictogram DROP FOREIGN KEY FK_A0B369B116B7C33B');
$this->addSql('ALTER TABLE visiting_card_pictogram DROP FOREIGN KEY FK_A0B369B1EB37EBA0');
$this->addSql('ALTER TABLE visiting_card_pictogram DROP PRIMARY KEY');
$this->addSql('ALTER TABLE visiting_card_pictogram DROP id, DROP position, CHANGE pictogram_id pictogram_id INT NOT NULL, CHANGE visiting_card_id visiting_card_id INT NOT NULL');
$this->addSql('ALTER TABLE visiting_card_pictogram ADD CONSTRAINT FK_A0B369B116B7C33B FOREIGN KEY (pictogram_id) REFERENCES pictogram (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE visiting_card_pictogram ADD CONSTRAINT FK_A0B369B1EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE visiting_card_pictogram ADD PRIMARY KEY (visiting_card_id, pictogram_id)');
}
}