<?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 Version20241206103902 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 questionnaire ADD rank_id INT NOT NULL');
$this->addSql('ALTER TABLE questionnaire ADD CONSTRAINT FK_7A64DAF7616678F FOREIGN KEY (rank_id) REFERENCES ranking (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_7A64DAF7616678F ON questionnaire (rank_id)');
$this->addSql('ALTER TABLE ranking ADD questionnaire_id INT');
$this->addSql('ALTER TABLE ranking ADD CONSTRAINT FK_80B839D0CE07E8FF FOREIGN KEY (questionnaire_id) REFERENCES questionnaire (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_80B839D0CE07E8FF ON ranking (questionnaire_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE questionnaire DROP FOREIGN KEY FK_7A64DAF7616678F');
$this->addSql('DROP INDEX UNIQ_7A64DAF7616678F ON questionnaire');
$this->addSql('ALTER TABLE questionnaire DROP rank_id');
$this->addSql('ALTER TABLE ranking DROP FOREIGN KEY FK_80B839D0CE07E8FF');
$this->addSql('DROP INDEX UNIQ_80B839D0CE07E8FF ON ranking');
$this->addSql('ALTER TABLE ranking DROP questionnaire_id');
}
}