<?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 Version20220721170044 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 groupe (id INT AUTO_INCREMENT NOT NULL, label VARCHAR(100) NOT NULL, date_creation DATETIME DEFAULT NULL, date_modification DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE groupe_droit (id INT AUTO_INCREMENT NOT NULL, groupe_id INT NOT NULL, page TINYINT(1) DEFAULT NULL, article TINYINT(1) DEFAULT NULL, article_param TINYINT(1) DEFAULT NULL, formulaire TINYINT(1) DEFAULT NULL, objet TINYINT(1) DEFAULT NULL, combi TINYINT(1) DEFAULT NULL, import_export TINYINT(1) DEFAULT NULL, date_creation DATETIME DEFAULT NULL, date_modification DATETIME DEFAULT NULL, INDEX IDX_9ED769017A45358C (groupe_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_role (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, groupe_id INT NOT NULL, projet_id INT NOT NULL, date_creation DATETIME DEFAULT NULL, date_modification DATETIME DEFAULT NULL, INDEX IDX_2DE8C6A3A76ED395 (user_id), INDEX IDX_2DE8C6A37A45358C (groupe_id), INDEX IDX_2DE8C6A3C18272 (projet_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE groupe_droit ADD CONSTRAINT FK_9ED769017A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)');
$this->addSql('ALTER TABLE user_role ADD CONSTRAINT FK_2DE8C6A3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user_role ADD CONSTRAINT FK_2DE8C6A37A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)');
$this->addSql('ALTER TABLE user_role ADD CONSTRAINT FK_2DE8C6A3C18272 FOREIGN KEY (projet_id) REFERENCES projet (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE groupe_droit DROP FOREIGN KEY FK_9ED769017A45358C');
$this->addSql('ALTER TABLE user_role DROP FOREIGN KEY FK_2DE8C6A37A45358C');
$this->addSql('DROP TABLE groupe');
$this->addSql('DROP TABLE groupe_droit');
$this->addSql('DROP TABLE user_role');
}
}