<?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 Version20220112154338 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 convocations (id INT AUTO_INCREMENT NOT NULL, intitule VARCHAR(255) NOT NULL, date_convoc DATETIME NOT NULL, date_expiration DATETIME NOT NULL, etat INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE convocations_stagiaires (convocations_id INT NOT NULL, stagiaires_id INT NOT NULL, INDEX IDX_B7FB7919DA415C9D (convocations_id), INDEX IDX_B7FB7919887A63F9 (stagiaires_id), PRIMARY KEY(convocations_id, stagiaires_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE convocations_stagiaires ADD CONSTRAINT FK_B7FB7919DA415C9D FOREIGN KEY (convocations_id) REFERENCES convocations (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE convocations_stagiaires ADD CONSTRAINT FK_B7FB7919887A63F9 FOREIGN KEY (stagiaires_id) REFERENCES stagiaires (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE formations ADD convocations_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE formations ADD CONSTRAINT FK_40902137DA415C9D FOREIGN KEY (convocations_id) REFERENCES convocations (id)');
$this->addSql('CREATE INDEX IDX_40902137DA415C9D ON formations (convocations_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE convocations_stagiaires DROP FOREIGN KEY FK_B7FB7919DA415C9D');
$this->addSql('ALTER TABLE formations DROP FOREIGN KEY FK_40902137DA415C9D');
$this->addSql('DROP TABLE convocations');
$this->addSql('DROP TABLE convocations_stagiaires');
$this->addSql('DROP INDEX IDX_40902137DA415C9D ON formations');
$this->addSql('ALTER TABLE formations DROP convocations_id');
}
}