migrations/Version20241220174640.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 Version20241220174640 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 checklist (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(191) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE checklist_task (checklist_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', task_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_D48EDEC2B16D08A7 (checklist_id), UNIQUE INDEX UNIQ_D48EDEC28DB60186 (task_id), PRIMARY KEY(checklist_id, task_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE checklist_task ADD CONSTRAINT FK_D48EDEC2B16D08A7 FOREIGN KEY (checklist_id) REFERENCES checklist (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE checklist_task ADD CONSTRAINT FK_D48EDEC28DB60186 FOREIGN KEY (task_id) REFERENCES task (id)');
  22.         $this->addSql('ALTER TABLE task_group_task DROP FOREIGN KEY FK_6737CBFA8DB60186');
  23.         $this->addSql('ALTER TABLE task_group_task DROP FOREIGN KEY FK_6737CBFABE94330B');
  24.         $this->addSql('ALTER TABLE task_template_task_group DROP FOREIGN KEY FK_E567CD1F43AFA28A');
  25.         $this->addSql('ALTER TABLE task_template_task_group DROP FOREIGN KEY FK_E567CD1FBE94330B');
  26.         $this->addSql('DROP TABLE task_group');
  27.         $this->addSql('DROP TABLE task_group_task');
  28.         $this->addSql('DROP TABLE task_template');
  29.         $this->addSql('DROP TABLE task_template_task_group');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('CREATE TABLE task_group (id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', group_name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  35.         $this->addSql('CREATE TABLE task_group_task (task_group_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', task_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_6737CBFA8DB60186 (task_id), INDEX IDX_6737CBFABE94330B (task_group_id), PRIMARY KEY(task_group_id, task_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  36.         $this->addSql('CREATE TABLE task_template (id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', template_name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  37.         $this->addSql('CREATE TABLE task_template_task_group (task_template_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', task_group_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_E567CD1FBE94330B (task_group_id), INDEX IDX_E567CD1F43AFA28A (task_template_id), PRIMARY KEY(task_template_id, task_group_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  38.         $this->addSql('ALTER TABLE task_group_task ADD CONSTRAINT FK_6737CBFA8DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  39.         $this->addSql('ALTER TABLE task_group_task ADD CONSTRAINT FK_6737CBFABE94330B FOREIGN KEY (task_group_id) REFERENCES task_group (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  40.         $this->addSql('ALTER TABLE task_template_task_group ADD CONSTRAINT FK_E567CD1F43AFA28A FOREIGN KEY (task_template_id) REFERENCES task_template (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  41.         $this->addSql('ALTER TABLE task_template_task_group ADD CONSTRAINT FK_E567CD1FBE94330B FOREIGN KEY (task_group_id) REFERENCES task_group (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  42.         $this->addSql('ALTER TABLE checklist_task DROP FOREIGN KEY FK_D48EDEC2B16D08A7');
  43.         $this->addSql('ALTER TABLE checklist_task DROP FOREIGN KEY FK_D48EDEC28DB60186');
  44.         $this->addSql('DROP TABLE checklist');
  45.         $this->addSql('DROP TABLE checklist_task');
  46.     }
  47. }