diff --git a/.changes/unreleased/Fixed-20251104-135108.yaml b/.changes/unreleased/Fixed-20251104-135108.yaml new file mode 100644 index 000000000..a96d57edb --- /dev/null +++ b/.changes/unreleased/Fixed-20251104-135108.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix the possibility to delete a workflow +time: 2025-11-04T13:51:08.113234488+01:00 +custom: + Issue: "" + SchemaChange: Drop or rename table or columns, or enforce new constraint that must be manually fixed diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index 24acc4f78..13978493a 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -123,7 +123,7 @@ class EntityWorkflowStep /** * @var Collection */ - #[ORM\OneToMany(mappedBy: 'step', targetEntity: EntityWorkflowStepHold::class)] + #[ORM\OneToMany(mappedBy: 'step', targetEntity: EntityWorkflowStepHold::class, cascade: ['remove'])] private Collection $holdsOnStep; /** diff --git a/src/Bundle/ChillMainBundle/migrations/Version20251104124123.php b/src/Bundle/ChillMainBundle/migrations/Version20251104124123.php new file mode 100644 index 000000000..9ba086f36 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20251104124123.php @@ -0,0 +1,46 @@ +addSql('ALTER TABLE chill_main_workflow_entity_step_hold + DROP CONSTRAINT fk_1be2e7c73b21e9c'); + + $this->addSql('ALTER TABLE chill_main_workflow_entity_step_hold + ADD CONSTRAINT fk_1be2e7c73b21e9c + FOREIGN KEY (step_id) + REFERENCES chill_main_workflow_entity_step (id) + ON DELETE CASCADE'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_workflow_entity_step_hold + DROP CONSTRAINT fk_1be2e7c73b21e9c'); + + $this->addSql('ALTER TABLE chill_main_workflow_entity_step_hold + ADD CONSTRAINT fk_1be2e7c73b21e9c + FOREIGN KEY (step_id) + REFERENCES chill_main_workflow_entity_step (id)'); + } +}