migrations/Version20211125121556.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 Version20211125121556 extends AbstractMigration
  10. {
  11. public function getDescription(): string
  12. {
  13. return 'Replace tree field by demand field';
  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 demand_tree DROP FOREIGN KEY FK_69FCFE9A78B64A2');
  19. $this->addSql('DROP INDEX UNIQ_69FCFE9A78B64A2 ON demand_tree');
  20. $this->addSql('ALTER TABLE demand_tree CHANGE tree_id demand_id INT NOT NULL');
  21. $this->addSql('ALTER TABLE demand_tree ADD CONSTRAINT FK_69FCFE9A5D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
  22. $this->addSql('CREATE UNIQUE INDEX UNIQ_69FCFE9A5D022E59 ON demand_tree (demand_id)');
  23. }
  24. public function down(Schema $schema): void
  25. {
  26. // this down() migration is auto-generated, please modify it to your needs
  27. $this->addSql('ALTER TABLE demand_tree DROP FOREIGN KEY FK_69FCFE9A5D022E59');
  28. $this->addSql('DROP INDEX UNIQ_69FCFE9A5D022E59 ON demand_tree');
  29. $this->addSql('ALTER TABLE demand_tree CHANGE demand_id tree_id INT NOT NULL');
  30. $this->addSql('ALTER TABLE demand_tree ADD CONSTRAINT FK_69FCFE9A78B64A2 FOREIGN KEY (tree_id) REFERENCES demand (id)');
  31. $this->addSql('CREATE UNIQUE INDEX UNIQ_69FCFE9A78B64A2 ON demand_tree (tree_id)');
  32. }
  33. }