<?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 Version20211125121556 extends AbstractMigration
{
public function getDescription(): string
{
return 'Replace tree field by demand field';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE demand_tree DROP FOREIGN KEY FK_69FCFE9A78B64A2');
$this->addSql('DROP INDEX UNIQ_69FCFE9A78B64A2 ON demand_tree');
$this->addSql('ALTER TABLE demand_tree CHANGE tree_id demand_id INT NOT NULL');
$this->addSql('ALTER TABLE demand_tree ADD CONSTRAINT FK_69FCFE9A5D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_69FCFE9A5D022E59 ON demand_tree (demand_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE demand_tree DROP FOREIGN KEY FK_69FCFE9A5D022E59');
$this->addSql('DROP INDEX UNIQ_69FCFE9A5D022E59 ON demand_tree');
$this->addSql('ALTER TABLE demand_tree CHANGE demand_id tree_id INT NOT NULL');
$this->addSql('ALTER TABLE demand_tree ADD CONSTRAINT FK_69FCFE9A78B64A2 FOREIGN KEY (tree_id) REFERENCES demand (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_69FCFE9A78B64A2 ON demand_tree (tree_id)');
}
}