<?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 Version20210907103940 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE tree_photo DROP FOREIGN KEY FK_ACB5A27DC746B832');
$this->addSql('ALTER TABLE tree_photo DROP FOREIGN KEY FK_ACB5A27DD5C72E60');
$this->addSql('DROP INDEX UNIQ_ACB5A27DD5C72E60 ON tree_photo');
$this->addSql('DROP INDEX IDX_ACB5A27DC746B832 ON tree_photo');
$this->addSql('ALTER TABLE tree_photo ADD tree_id INT NOT NULL, ADD file_id INT NOT NULL, DROP tree_id_id, DROP file_id_id');
$this->addSql('ALTER TABLE tree_photo ADD CONSTRAINT FK_ACB5A27D78B64A2 FOREIGN KEY (tree_id) REFERENCES tree (id)');
$this->addSql('ALTER TABLE tree_photo ADD CONSTRAINT FK_ACB5A27D93CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
$this->addSql('CREATE INDEX IDX_ACB5A27D78B64A2 ON tree_photo (tree_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_ACB5A27D93CB796C ON tree_photo (file_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE tree_photo DROP FOREIGN KEY FK_ACB5A27D78B64A2');
$this->addSql('ALTER TABLE tree_photo DROP FOREIGN KEY FK_ACB5A27D93CB796C');
$this->addSql('DROP INDEX IDX_ACB5A27D78B64A2 ON tree_photo');
$this->addSql('DROP INDEX UNIQ_ACB5A27D93CB796C ON tree_photo');
$this->addSql('ALTER TABLE tree_photo ADD tree_id_id INT NOT NULL, ADD file_id_id INT NOT NULL, DROP tree_id, DROP file_id');
$this->addSql('ALTER TABLE tree_photo ADD CONSTRAINT FK_ACB5A27DC746B832 FOREIGN KEY (tree_id_id) REFERENCES tree (id)');
$this->addSql('ALTER TABLE tree_photo ADD CONSTRAINT FK_ACB5A27DD5C72E60 FOREIGN KEY (file_id_id) REFERENCES file (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_ACB5A27DD5C72E60 ON tree_photo (file_id_id)');
$this->addSql('CREATE INDEX IDX_ACB5A27DC746B832 ON tree_photo (tree_id_id)');
}
}