Fix round deletion FK constraint with migration and defensive code
- Add SQL migration to CASCADE Evaluation.formId and SET NULL ProjectFile.roundId - Explicitly delete evaluations in round delete transaction as defensive measure - Make sidebar Apply Page link dynamic using current edition context Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -615,6 +615,12 @@ export const roundRouter = router({
|
||||
userAgent: ctx.userAgent,
|
||||
})
|
||||
|
||||
// Delete evaluations first to avoid FK constraint on Evaluation.formId
|
||||
// (formId FK may not have CASCADE in older DB schemas)
|
||||
await tx.evaluation.deleteMany({
|
||||
where: { form: { roundId: input.id } },
|
||||
})
|
||||
|
||||
await tx.round.delete({
|
||||
where: { id: input.id },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user