migrations/Version20230320221801.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7. * Auto-generated Migration: Please modify to your needs!
  8. */
  9. final class Version20230320221801 extends AbstractMigration
  10. {
  11. public function getDescription(): string
  12. {
  13. return '';
  14. }
  15. public function up(Schema $schema): void
  16. {
  17. // this up() migration is auto-generated, please modify it to your needs
  18. $this->addSql('ALTER TABLE delivery_recipient ADD position_id INT DEFAULT NULL');
  19. $this->addSql('ALTER TABLE delivery_recipient ADD CONSTRAINT FK_2C61B7DBDD842E46 FOREIGN KEY (position_id) REFERENCES tracking (id)');
  20. $this->addSql('CREATE UNIQUE INDEX UNIQ_2C61B7DBDD842E46 ON delivery_recipient (position_id)');
  21. $this->addSql('ALTER TABLE delivery_sender ADD position_id INT DEFAULT NULL');
  22. $this->addSql('ALTER TABLE delivery_sender ADD CONSTRAINT FK_4111B341DD842E46 FOREIGN KEY (position_id) REFERENCES tracking (id)');
  23. $this->addSql('CREATE UNIQUE INDEX UNIQ_4111B341DD842E46 ON delivery_sender (position_id)');
  24. $this->addSql('ALTER TABLE tracking DROP FOREIGN KEY FK_A87C621C591CC992');
  25. $this->addSql('DROP INDEX IDX_A87C621C591CC992 ON tracking');
  26. $this->addSql('ALTER TABLE tracking DROP course_id');
  27. }
  28. public function down(Schema $schema): void
  29. {
  30. // this down() migration is auto-generated, please modify it to your needs
  31. $this->addSql('ALTER TABLE delivery_recipient DROP FOREIGN KEY FK_2C61B7DBDD842E46');
  32. $this->addSql('DROP INDEX UNIQ_2C61B7DBDD842E46 ON delivery_recipient');
  33. $this->addSql('ALTER TABLE delivery_recipient DROP position_id');
  34. $this->addSql('ALTER TABLE delivery_sender DROP FOREIGN KEY FK_4111B341DD842E46');
  35. $this->addSql('DROP INDEX UNIQ_4111B341DD842E46 ON delivery_sender');
  36. $this->addSql('ALTER TABLE delivery_sender DROP position_id');
  37. $this->addSql('ALTER TABLE tracking ADD course_id INT NOT NULL');
  38. $this->addSql('ALTER TABLE tracking ADD CONSTRAINT FK_A87C621C591CC992 FOREIGN KEY (course_id) REFERENCES course (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  39. $this->addSql('CREATE INDEX IDX_A87C621C591CC992 ON tracking (course_id)');
  40. }
  41. }