Version20250803035835.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 Version20250803035835 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 party (id INT AUTO_INCREMENT NOT NULL, gamemaster_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', game_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', start_on DATETIME DEFAULT NULL, end_on DATETIME DEFAULT NULL, gamemaster_is_author TINYINT(1) DEFAULT NULL, min_participants INT DEFAULT NULL, max_participants INT DEFAULT NULL, INDEX IDX_89954EE096376157 (gamemaster_id), INDEX IDX_89954EE0E48FD905 (game_id), INDEX IDX_89954EE071F7E88B (event_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE096376157 FOREIGN KEY (gamemaster_id) REFERENCES gamemaster (id)');
  20. $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE0E48FD905 FOREIGN KEY (game_id) REFERENCES game (id)');
  21. $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE071F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
  22. $this->addSql('ALTER TABLE slot ADD party_id INT DEFAULT NULL');
  23. $this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E2067213C1059 FOREIGN KEY (party_id) REFERENCES party (id)');
  24. $this->addSql('CREATE INDEX IDX_AC0E2067213C1059 ON slot (party_id)');
  25. }
  26. public function down(Schema $schema): void
  27. {
  28. // this down() migration is auto-generated, please modify it to your needs
  29. $this->addSql('ALTER TABLE slot DROP FOREIGN KEY FK_AC0E2067213C1059');
  30. $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE096376157');
  31. $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE0E48FD905');
  32. $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE071F7E88B');
  33. $this->addSql('DROP TABLE party');
  34. $this->addSql('DROP INDEX IDX_AC0E2067213C1059 ON slot');
  35. $this->addSql('ALTER TABLE slot DROP party_id');
  36. }
  37. }