@@ -64,23 +64,23 @@ enum ReviewOpportunityTypeEnum {
6464//////////////////////////////////////////
6565
6666model Challenge {
67- id String @id @default (uuid () )
68- name String
69- description String ?
70- privateDescription String ?
71- challengeSource String ?
72- descriptionFormat String ?
73- projectId Int ? // frequently queried field
74- typeId String
75- trackId String // FK for relation in ChallengeTrack
76- timelineTemplateId String ? // now used as foreign key to ChallengeTimelineTemplate
77- overviewTotalPrizes Float ? // stored from overview.totalPrizes
78- numOfRegistrants Int @default (0 )
79- numOfSubmissions Int @default (0 )
80- numOfCheckpointSubmissions Int @default (0 )
81- currentPhaseNames String [] // current phase names
82-
83- wiproAllowed Boolean @default (false )
67+ id String @id @default (uuid () )
68+ name String
69+ description String ?
70+ privateDescription String ?
71+ challengeSource String ?
72+ descriptionFormat String ?
73+ projectId Int ? // frequently queried field
74+ typeId String
75+ trackId String // FK for relation in ChallengeTrack
76+ timelineTemplateId String ? // now used as foreign key to ChallengeTimelineTemplate
77+ overviewTotalPrizes Float ? // stored from overview.totalPrizes
78+ numOfRegistrants Int @default (0 )
79+ numOfSubmissions Int @default (0 )
80+ numOfCheckpointSubmissions Int @default (0 )
81+ currentPhaseNames String [] // current phase names
82+
83+ wiproAllowed Boolean @default (false )
8484
8585 // simple arrays for tags and groups (PostgreSQL native array type)
8686 tags String []
@@ -499,6 +499,7 @@ model Phase {
499499 // Inverse relation for associated challenge phases
500500 challengePhases ChallengePhase []
501501 ChallengeReviewer ChallengeReviewer []
502+ DefaultChallengeReviewer DefaultChallengeReviewer []
502503
503504 @@unique ([name ] )
504505}
@@ -590,7 +591,7 @@ model ChallengeReviewer {
590591 basePayment Float ?
591592 incrementalPayment Float ?
592593 type ReviewOpportunityTypeEnum ?
593- aiWorkflowId String ? @db.VarChar (14 )
594+ aiWorkflowId String ? @db.VarChar (14 )
594595
595596 // Relation to the challenge
596597 challenge Challenge @relation (fields : [challengeId ] , references : [id ] , onDelete : Cascade )
@@ -620,6 +621,8 @@ model DefaultChallengeReviewer {
620621 isMemberReview Boolean
621622 memberReviewerCount Int ?
622623 phaseName String
624+ // Optional explicit link to Phase for better fidelity
625+ phaseId String ?
623626 basePayment Float ?
624627 incrementalPayment Float ?
625628 opportunityType ReviewOpportunityTypeEnum ?
@@ -628,7 +631,8 @@ model DefaultChallengeReviewer {
628631 // Relations
629632 challengeType ChallengeType @relation (fields : [typeId ] , references : [id ] )
630633 challengeTrack ChallengeTrack @relation (fields : [trackId ] , references : [id ] )
631- // no relation to Phase; we store phase name for flexibility
634+ // Relation to Phase (optional for backward compatibility with phaseName)
635+ phase Phase ? @relation (fields : [phaseId ] , references : [id ] )
632636
633637 // Auditing fields
634638 createdAt DateTime @default (now () )
@@ -637,6 +641,7 @@ model DefaultChallengeReviewer {
637641 updatedBy String
638642
639643 @@index ([typeId , trackId ] )
644+ @@index ([phaseId ] )
640645}
641646
642647//////////////////////////////////////////
0 commit comments