<?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 Version20211125105910 extends AbstractMigration
{
public function getDescription(): string
{
return 'Added nullable to demand tree in demand propertie';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE demand ADD demand_tree_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D7973A8F18A7B FOREIGN KEY (demand_tree_id) REFERENCES demand_tree (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_428D7973A8F18A7B ON demand (demand_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 DROP FOREIGN KEY FK_428D7973A8F18A7B');
$this->addSql('DROP INDEX UNIQ_428D7973A8F18A7B ON demand');
$this->addSql('ALTER TABLE demand CHANGE demand_tree_id demand_tree_id INT NOT NULL');
}
}