Using the cursor saving mechanism from base sql script as checkpoints
Cursor position is saved after successfully migrating a course entity
Cursor position is loaded when first start up the script, and the course entity A it points to if is not marked as migrated, a casecadeDelete method will be called to delete all related entities in the sql database and migration will restart from A.
Edit:
CascadeType.REMOVE is already present for most parts of the chain but not present for Course-FeedbackSession, Course-User. For easier implementation for deleteCourseCascade, added cascade = CascadeType.REMOVE annotation for the two relations in Course.java.
Part of https://github.com/TEAMMATES/teammates/issues/12048
Outline of Solution
casecadeDelete
method will be called to delete all related entities in the sql database and migration will restart from A.Edit:
CascadeType.REMOVE
is already present for most parts of the chain but not present for Course-FeedbackSession, Course-User. For easier implementation fordeleteCourseCascade
, addedcascade = CascadeType.REMOVE
annotation for the two relations inCourse.java
.