<?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 Version20211213152113 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 blocs (id INT AUTO_INCREMENT NOT NULL, intitule VARCHAR(255) NOT NULL, nbre_heures INT NOT NULL, etat INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE formations (id INT AUTO_INCREMENT NOT NULL, site_id INT DEFAULT NULL, bloc_id INT DEFAULT NULL, intitule VARCHAR(255) NOT NULL, date_debut DATETIME NOT NULL, date_fin DATETIME NOT NULL, etat INT NOT NULL, INDEX IDX_40902137F6BD1646 (site_id), INDEX IDX_409021375582E9C0 (bloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE formations ADD CONSTRAINT FK_40902137F6BD1646 FOREIGN KEY (site_id) REFERENCES sites (id)');
$this->addSql('ALTER TABLE formations ADD CONSTRAINT FK_409021375582E9C0 FOREIGN KEY (bloc_id) REFERENCES blocs (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE formations DROP FOREIGN KEY FK_409021375582E9C0');
$this->addSql('DROP TABLE blocs');
$this->addSql('DROP TABLE formations');
}
}