migrations/Version20250113184427.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 Version20250113184427 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('ALTER TABLE checklist_task DROP FOREIGN KEY FK_D48EDEC2B16D08A7');
  19.         $this->addSql('ALTER TABLE checklist_task DROP FOREIGN KEY FK_6EB0E2498DB60186');
  20.         $this->addSql('DROP TABLE checklist_task');
  21.         $this->addSql('ALTER TABLE task ADD checklist_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
  22.         $this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB25B16D08A7 FOREIGN KEY (checklist_id) REFERENCES checklist (id)');
  23.         $this->addSql('CREATE INDEX IDX_527EDB25B16D08A7 ON task (checklist_id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('CREATE TABLE checklist_task (checklist_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_D48EDEC28DB60186 (task_id), INDEX IDX_D48EDEC2B16D08A7 (checklist_id), PRIMARY KEY(checklist_id, task_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  29.         $this->addSql('ALTER TABLE checklist_task ADD CONSTRAINT FK_D48EDEC2B16D08A7 FOREIGN KEY (checklist_id) REFERENCES checklist (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  30.         $this->addSql('ALTER TABLE checklist_task ADD CONSTRAINT FK_6EB0E2498DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  31.         $this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB25B16D08A7');
  32.         $this->addSql('DROP INDEX IDX_527EDB25B16D08A7 ON task');
  33.         $this->addSql('ALTER TABLE task DROP checklist_id');
  34.     }
  35. }