<?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 Version20210714052044 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 (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, description VARCHAR(100) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE niveau_filiere (id INT AUTO_INCREMENT NOT NULL, niveau_id INT NOT NULL, filiere_id INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4EC4E7E8B3E9C81 (niveau_id), INDEX IDX_4EC4E7E8180AA129 (filiere_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE niveau_filiere ADD CONSTRAINT FK_4EC4E7E8B3E9C81 FOREIGN KEY (niveau_id) REFERENCES niveau (id)');
$this->addSql('ALTER TABLE niveau_filiere ADD CONSTRAINT FK_4EC4E7E8180AA129 FOREIGN KEY (filiere_id) REFERENCES filiere (id)');
$this->addSql('ALTER TABLE etudiant CHANGE sexe sexe VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE niveau ADD description VARCHAR(100) DEFAULT NULL');
}
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_4EC4E7E8180AA129');
$this->addSql('DROP TABLE filiere');
$this->addSql('DROP TABLE niveau_filiere');
$this->addSql('ALTER TABLE etudiant CHANGE sexe sexe VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE niveau DROP description');
}
}