<?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 Version20241220174640 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 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');
$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');
$this->addSql('ALTER TABLE checklist_task ADD CONSTRAINT FK_D48EDEC2B16D08A7 FOREIGN KEY (checklist_id) REFERENCES checklist (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE checklist_task ADD CONSTRAINT FK_D48EDEC28DB60186 FOREIGN KEY (task_id) REFERENCES task (id)');
$this->addSql('ALTER TABLE task_group_task DROP FOREIGN KEY FK_6737CBFA8DB60186');
$this->addSql('ALTER TABLE task_group_task DROP FOREIGN KEY FK_6737CBFABE94330B');
$this->addSql('ALTER TABLE task_template_task_group DROP FOREIGN KEY FK_E567CD1F43AFA28A');
$this->addSql('ALTER TABLE task_template_task_group DROP FOREIGN KEY FK_E567CD1FBE94330B');
$this->addSql('DROP TABLE task_group');
$this->addSql('DROP TABLE task_group_task');
$this->addSql('DROP TABLE task_template');
$this->addSql('DROP TABLE task_template_task_group');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$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 = \'\' ');
$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 = \'\' ');
$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 = \'\' ');
$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 = \'\' ');
$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');
$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');
$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');
$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');
$this->addSql('ALTER TABLE checklist_task DROP FOREIGN KEY FK_D48EDEC2B16D08A7');
$this->addSql('ALTER TABLE checklist_task DROP FOREIGN KEY FK_D48EDEC28DB60186');
$this->addSql('DROP TABLE checklist');
$this->addSql('DROP TABLE checklist_task');
}
}