<?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 Version20230320221801 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 delivery_recipient ADD position_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE delivery_recipient ADD CONSTRAINT FK_2C61B7DBDD842E46 FOREIGN KEY (position_id) REFERENCES tracking (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2C61B7DBDD842E46 ON delivery_recipient (position_id)');
$this->addSql('ALTER TABLE delivery_sender ADD position_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE delivery_sender ADD CONSTRAINT FK_4111B341DD842E46 FOREIGN KEY (position_id) REFERENCES tracking (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4111B341DD842E46 ON delivery_sender (position_id)');
$this->addSql('ALTER TABLE tracking DROP FOREIGN KEY FK_A87C621C591CC992');
$this->addSql('DROP INDEX IDX_A87C621C591CC992 ON tracking');
$this->addSql('ALTER TABLE tracking DROP course_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE delivery_recipient DROP FOREIGN KEY FK_2C61B7DBDD842E46');
$this->addSql('DROP INDEX UNIQ_2C61B7DBDD842E46 ON delivery_recipient');
$this->addSql('ALTER TABLE delivery_recipient DROP position_id');
$this->addSql('ALTER TABLE delivery_sender DROP FOREIGN KEY FK_4111B341DD842E46');
$this->addSql('DROP INDEX UNIQ_4111B341DD842E46 ON delivery_sender');
$this->addSql('ALTER TABLE delivery_sender DROP position_id');
$this->addSql('ALTER TABLE tracking ADD course_id INT NOT NULL');
$this->addSql('ALTER TABLE tracking ADD CONSTRAINT FK_A87C621C591CC992 FOREIGN KEY (course_id) REFERENCES course (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_A87C621C591CC992 ON tracking (course_id)');
}
}