migrations/Version20220525184954.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7. * Auto-generated Migration: Please modify to your needs!
  8. */
  9. final class Version20220525184954 extends AbstractMigration
  10. {
  11. public function getDescription(): string
  12. {
  13. return '';
  14. }
  15. public function up(Schema $schema): void
  16. {
  17. // this up() migration is auto-generated, please modify it to your needs
  18. $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');
  19. $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');
  20. $this->addSql('ALTER TABLE acteur ADD CONSTRAINT FK_EAFAD362FB88E14F FOREIGN KEY (utilisateur_id) REFERENCES utilisateur (id)');
  21. $this->addSql('ALTER TABLE acteur ADD CONSTRAINT FK_EAFAD362C18272 FOREIGN KEY (projet_id) REFERENCES projet (id)');
  22. $this->addSql('ALTER TABLE tache ADD acteur_id INT DEFAULT NULL, ADD projet_id INT DEFAULT NULL');
  23. $this->addSql('ALTER TABLE tache ADD CONSTRAINT FK_93872075DA6F574A FOREIGN KEY (acteur_id) REFERENCES acteur (id)');
  24. $this->addSql('ALTER TABLE tache ADD CONSTRAINT FK_93872075C18272 FOREIGN KEY (projet_id) REFERENCES projet (id)');
  25. $this->addSql('CREATE INDEX IDX_93872075DA6F574A ON tache (acteur_id)');
  26. $this->addSql('CREATE INDEX IDX_93872075C18272 ON tache (projet_id)');
  27. }
  28. public function down(Schema $schema): void
  29. {
  30. // this down() migration is auto-generated, please modify it to your needs
  31. $this->addSql('ALTER TABLE tache DROP FOREIGN KEY FK_93872075DA6F574A');
  32. $this->addSql('ALTER TABLE acteur DROP FOREIGN KEY FK_EAFAD362C18272');
  33. $this->addSql('ALTER TABLE tache DROP FOREIGN KEY FK_93872075C18272');
  34. $this->addSql('DROP TABLE acteur');
  35. $this->addSql('DROP TABLE projet');
  36. $this->addSql('DROP INDEX IDX_93872075DA6F574A ON tache');
  37. $this->addSql('DROP INDEX IDX_93872075C18272 ON tache');
  38. $this->addSql('ALTER TABLE tache DROP acteur_id, DROP projet_id');
  39. }
  40. }