Reconcile schema with migrations and fix failed migration
- Align schema.prisma with add_15_features migration (15 discrepancies): nullability, column names, PKs, missing/extra columns, onDelete behavior - Make universal_apply_programid migration idempotent for safe re-execution - Add reconciliation migration for missing FKs and indexes - Fix message.ts and mentor.ts to match corrected schema field names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -674,11 +674,23 @@ export const evaluationRouter = router({
|
||||
})
|
||||
}
|
||||
|
||||
return assignments.map((a) => ({
|
||||
project: a.project,
|
||||
evaluation: a.evaluation,
|
||||
assignmentId: a.id,
|
||||
}))
|
||||
// Fetch the active evaluation form for this round to get criteria labels
|
||||
const evaluationForm = await ctx.prisma.evaluationForm.findFirst({
|
||||
where: { roundId: input.roundId, isActive: true },
|
||||
select: { criteriaJson: true, scalesJson: true },
|
||||
})
|
||||
|
||||
return {
|
||||
items: assignments.map((a) => ({
|
||||
project: a.project,
|
||||
evaluation: a.evaluation,
|
||||
assignmentId: a.id,
|
||||
})),
|
||||
criteria: evaluationForm?.criteriaJson as Array<{
|
||||
id: string; label: string; description?: string; scale?: string; weight?: number; type?: string
|
||||
}> | null,
|
||||
scales: evaluationForm?.scalesJson as Record<string, { min: number; max: number }> | null,
|
||||
}
|
||||
}),
|
||||
|
||||
// =========================================================================
|
||||
|
||||
@@ -1057,7 +1057,7 @@ export const mentorRouter = router({
|
||||
userId: ctx.user.id,
|
||||
action: 'COMPLETE_MILESTONE',
|
||||
entityType: 'MentorMilestoneCompletion',
|
||||
entityId: `${completion.milestoneId}_${completion.mentorAssignmentId}`,
|
||||
entityId: completion.id,
|
||||
detailsJson: {
|
||||
milestoneId: input.milestoneId,
|
||||
mentorAssignmentId: input.mentorAssignmentId,
|
||||
|
||||
@@ -247,7 +247,7 @@ export const messageRouter = router({
|
||||
subject: input.subject,
|
||||
body: input.body,
|
||||
variables: input.variables ?? undefined,
|
||||
createdById: ctx.user.id,
|
||||
createdBy: ctx.user.id,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user