<?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 Version20220913141148 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 citizen ADD main_address_id INT DEFAULT NULL, ADD second_address_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE citizen ADD CONSTRAINT FK_A9531729CD4FDB16 FOREIGN KEY (main_address_id) REFERENCES address (id)');
$this->addSql('ALTER TABLE citizen ADD CONSTRAINT FK_A953172916E94FE6 FOREIGN KEY (second_address_id) REFERENCES address (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A9531729CD4FDB16 ON citizen (main_address_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A953172916E94FE6 ON citizen (second_address_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE citizen DROP FOREIGN KEY FK_A9531729CD4FDB16');
$this->addSql('ALTER TABLE citizen DROP FOREIGN KEY FK_A953172916E94FE6');
$this->addSql('DROP INDEX UNIQ_A9531729CD4FDB16 ON citizen');
$this->addSql('DROP INDEX UNIQ_A953172916E94FE6 ON citizen');
$this->addSql('ALTER TABLE citizen DROP main_address_id, DROP second_address_id');
}
}