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:
2026-02-10 20:42:33 +01:00
parent 5c4200158f
commit 573785e440
3 changed files with 30 additions and 1 deletions

View File

@@ -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 },
})