Skip to content

Commit

Permalink
Add correct removal logic to avoid constraint violation
Browse files Browse the repository at this point in the history
  • Loading branch information
domoberzin committed Feb 25, 2024
1 parent 7810213 commit 09df7f1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/teammates/sqllogic/core/DataBundleLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,18 @@ public void removeDataBundle(SqlDataBundle dataBundle) throws InvalidParametersE
throw new InvalidParametersException("Data bundle is null");
}

dataBundle.feedbackResponseComments.values().forEach(responseComment -> {
frcLogic.deleteFeedbackResponseComment(responseComment.getId());
});

dataBundle.feedbackSessions.values().forEach(session -> {
fsLogic.deleteFeedbackSessionCascade(session.getName(), session.getCourse().getId());
});

dataBundle.feedbackQuestions.values().forEach(question -> {
fqLogic.deleteFeedbackQuestionCascade(question.getId());
});

dataBundle.courses.values().forEach(course -> {
coursesLogic.deleteCourseCascade(course.getId());
});
Expand Down

0 comments on commit 09df7f1

Please sign in to comment.