From 1c30a777ad2992e73eb0d83196a9063ddf32cbf2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 11 Jun 2013 16:57:22 +0200 Subject: [PATCH] Fix project/jobset deletion --- src/lib/Hydra/Controller/Jobset.pm | 6 +++++- src/lib/Hydra/Controller/Project.pm | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 00fbf4ef..29e7418e 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -132,7 +132,11 @@ sub submit : Chained('jobset') PathPart Args(0) { requirePost($c); if (($c->request->params->{submit} // "") eq "delete") { - $c->stash->{jobset}->delete; + txn_do($c->model('DB')->schema, sub { + $c->stash->{jobset}->jobsetevals->delete_all; + $c->stash->{jobset}->builds->delete_all; + $c->stash->{jobset}->delete; + }); return $c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"), [$c->stash->{project}->name])); } diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 79de53a3..84516473 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -46,7 +46,11 @@ sub submit : Chained('project') PathPart Args(0) { requirePost($c); if (($c->request->params->{submit} // "") eq "delete") { - $c->stash->{project}->delete; + txn_do($c->model('DB')->schema, sub { + $c->stash->{project}->jobsetevals->delete_all; + $c->stash->{project}->builds->delete_all; + $c->stash->{project}->delete; + }); return $c->res->redirect($c->uri_for("/")); }