<?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 Version20210730051734 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 inscription DROP FOREIGN KEY FK_5E90F6D68F5EA509');
$this->addSql('DROP INDEX IDX_5E90F6D68F5EA509 ON inscription');
$this->addSql('ALTER TABLE inscription CHANGE classe_id groupe_id INT NOT NULL');
$this->addSql('ALTER TABLE inscription ADD CONSTRAINT FK_5E90F6D67A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)');
$this->addSql('CREATE INDEX IDX_5E90F6D67A45358C ON inscription (groupe_id)');
$this->addSql('CREATE UNIQUE INDEX inscription_idx ON inscription (etudiant_id, annee_academique_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE inscription DROP FOREIGN KEY FK_5E90F6D67A45358C');
$this->addSql('DROP INDEX IDX_5E90F6D67A45358C ON inscription');
$this->addSql('DROP INDEX inscription_idx ON inscription');
$this->addSql('ALTER TABLE inscription CHANGE groupe_id classe_id INT NOT NULL');
$this->addSql('ALTER TABLE inscription ADD CONSTRAINT FK_5E90F6D68F5EA509 FOREIGN KEY (classe_id) REFERENCES classe (id)');
$this->addSql('CREATE INDEX IDX_5E90F6D68F5EA509 ON inscription (classe_id)');
}
}