Fix project/jobset deletion

This commit is contained in:
Eelco Dolstra 2013-06-11 16:57:22 +02:00
parent 40debf1515
commit 1c30a777ad
2 changed files with 10 additions and 2 deletions

View file

@ -132,7 +132,11 @@ sub submit : Chained('jobset') PathPart Args(0) {
requirePost($c); requirePost($c);
if (($c->request->params->{submit} // "") eq "delete") { if (($c->request->params->{submit} // "") eq "delete") {
txn_do($c->model('DB')->schema, sub {
$c->stash->{jobset}->jobsetevals->delete_all;
$c->stash->{jobset}->builds->delete_all;
$c->stash->{jobset}->delete; $c->stash->{jobset}->delete;
});
return $c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"), [$c->stash->{project}->name])); return $c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"), [$c->stash->{project}->name]));
} }

View file

@ -46,7 +46,11 @@ sub submit : Chained('project') PathPart Args(0) {
requirePost($c); requirePost($c);
if (($c->request->params->{submit} // "") eq "delete") { if (($c->request->params->{submit} // "") eq "delete") {
txn_do($c->model('DB')->schema, sub {
$c->stash->{project}->jobsetevals->delete_all;
$c->stash->{project}->builds->delete_all;
$c->stash->{project}->delete; $c->stash->{project}->delete;
});
return $c->res->redirect($c->uri_for("/")); return $c->res->redirect($c->uri_for("/"));
} }