<?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 Version20211003180007 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('CREATE TABLE filiere_specialite (filiere_id INT NOT NULL, specialite_id INT NOT NULL, INDEX IDX_BBEDEA4E180AA129 (filiere_id), INDEX IDX_BBEDEA4E2195E0F0 (specialite_id), PRIMARY KEY(filiere_id, specialite_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE specialite (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(100) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE filiere_specialite ADD CONSTRAINT FK_BBEDEA4E180AA129 FOREIGN KEY (filiere_id) REFERENCES filiere (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE filiere_specialite ADD CONSTRAINT FK_BBEDEA4E2195E0F0 FOREIGN KEY (specialite_id) REFERENCES specialite (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE etudiant CHANGE sexe sexe VARCHAR(255) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE filiere_specialite DROP FOREIGN KEY FK_BBEDEA4E2195E0F0');
$this->addSql('DROP TABLE filiere_specialite');
$this->addSql('DROP TABLE specialite');
$this->addSql('ALTER TABLE etudiant CHANGE sexe sexe VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
}
}