diff --git a/app/models/Project.java b/app/models/Project.java index 4561ef0ef..76a06703a 100644 --- a/app/models/Project.java +++ b/app/models/Project.java @@ -609,14 +609,16 @@ public void delete() { label.update(); } - for(IssueLabelCategory category : IssueLabelCategory.findByProject(this)) { - category.delete(); - } - + // Issues must be deleted before issue labels because issues may refer + // issue labels. for(Issue issue : issues) { issue.delete(); } + for(IssueLabelCategory category : IssueLabelCategory.findByProject(this)) { + category.delete(); + } + for (Assignee assignee : assignees) { assignee.delete(); }