Skip to content

Commit

Permalink
Fixes #34101 - Drop locks and links when deleting tasks
Browse files Browse the repository at this point in the history
(cherry picked from commit 2711d13)
  • Loading branch information
adamruzicka authored and upadhyeammit committed Mar 9, 2022
1 parent deeb9d5 commit af6f856
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions definitions/features/foreman_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def delete(state)
DELETE FROM dynflow_actions USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_actions.execution_plan_uuid::varchar) AND #{tasks_condition};
DELETE FROM dynflow_execution_plans USING foreman_tasks_tasks WHERE (foreman_tasks_tasks.external_id = dynflow_execution_plans.uuid::varchar) AND #{tasks_condition};
DELETE FROM foreman_tasks_tasks WHERE #{tasks_condition};
-- Delete locks and links which may now be orphaned
DELETE FROM foreman_tasks_locks as ftl where ftl.id NOT IN (SELECT id FROM foreman_tasks_tasks);
DELETE FROM foreman_tasks_links as ftl where ftl.id NOT IN (SELECT id FROM foreman_tasks_tasks);
COMMIT;
SQL

Expand Down

0 comments on commit af6f856

Please sign in to comment.