<?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 Version20240119110443 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds replacement_tree_id table on demand_tree column.';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE demand_tree ADD replacement_tree_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE demand_tree ADD CONSTRAINT FK_69FCFE9AD4CFA1A7 FOREIGN KEY (replacement_tree_id) REFERENCES tree (id)');
$this->addSql('CREATE INDEX IDX_69FCFE9AD4CFA1A7 ON demand_tree (replacement_tree_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_69FCFE9AD4CFA1A7');
$this->addSql('DROP INDEX IDX_69FCFE9AD4CFA1A7 ON demand_tree');
$this->addSql('ALTER TABLE demand_tree DROP replacement_tree_id');
}
}