<?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 Version20230420045800 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('DROP INDEX niveau_filiere_idx ON niveau_filiere');
$this->addSql('ALTER TABLE niveau_filiere ADD modalite_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE niveau_filiere ADD CONSTRAINT FK_4EC4E7E837A260BC FOREIGN KEY (modalite_id) REFERENCES modalite (id)');
$this->addSql('CREATE INDEX IDX_4EC4E7E837A260BC ON niveau_filiere (modalite_id)');
$this->addSql('CREATE UNIQUE INDEX niveau_filiere_idx ON niveau_filiere (niveau_id, filiere_id, specialite_id, modalite_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE niveau_filiere DROP FOREIGN KEY FK_4EC4E7E837A260BC');
$this->addSql('DROP INDEX IDX_4EC4E7E837A260BC ON niveau_filiere');
$this->addSql('DROP INDEX niveau_filiere_idx ON niveau_filiere');
$this->addSql('ALTER TABLE niveau_filiere DROP modalite_id');
$this->addSql('CREATE UNIQUE INDEX niveau_filiere_idx ON niveau_filiere (niveau_id, filiere_id, specialite_id)');
}
}