<?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 Version20220525184954 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 acteur (id INT AUTO_INCREMENT NOT NULL, utilisateur_id INT NOT NULL, projet_id INT NOT NULL, INDEX IDX_EAFAD362FB88E14F (utilisateur_id), INDEX IDX_EAFAD362C18272 (projet_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE projet (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) NOT NULL, date_debut DATE DEFAULT NULL, date_fin DATE DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE acteur ADD CONSTRAINT FK_EAFAD362FB88E14F FOREIGN KEY (utilisateur_id) REFERENCES utilisateur (id)');
$this->addSql('ALTER TABLE acteur ADD CONSTRAINT FK_EAFAD362C18272 FOREIGN KEY (projet_id) REFERENCES projet (id)');
$this->addSql('ALTER TABLE tache ADD acteur_id INT DEFAULT NULL, ADD projet_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE tache ADD CONSTRAINT FK_93872075DA6F574A FOREIGN KEY (acteur_id) REFERENCES acteur (id)');
$this->addSql('ALTER TABLE tache ADD CONSTRAINT FK_93872075C18272 FOREIGN KEY (projet_id) REFERENCES projet (id)');
$this->addSql('CREATE INDEX IDX_93872075DA6F574A ON tache (acteur_id)');
$this->addSql('CREATE INDEX IDX_93872075C18272 ON tache (projet_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE tache DROP FOREIGN KEY FK_93872075DA6F574A');
$this->addSql('ALTER TABLE acteur DROP FOREIGN KEY FK_EAFAD362C18272');
$this->addSql('ALTER TABLE tache DROP FOREIGN KEY FK_93872075C18272');
$this->addSql('DROP TABLE acteur');
$this->addSql('DROP TABLE projet');
$this->addSql('DROP INDEX IDX_93872075DA6F574A ON tache');
$this->addSql('DROP INDEX IDX_93872075C18272 ON tache');
$this->addSql('ALTER TABLE tache DROP acteur_id, DROP projet_id');
}
}