Skip to content

Commit af62e0b

Browse files
committed
Revert "**Final Answer**"
This reverts commit 7f7fdb4.
1 parent 7f7fdb4 commit af62e0b

File tree

1 file changed

+55
-74
lines changed

1 file changed

+55
-74
lines changed

prisma/schema.prisma

Lines changed: 55 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,31 @@ datasource db {
1515
}
1616

1717
model scorecard {
18-
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14) # Primary key with auto-generation using nanoid()
19-
legacyId String? # Optional unique identifier from legacy system
20-
status ScorecardStatus # Enum: ACTIVE, INACTIVE, DELETED (for overall scorecard status)
21-
type ScorecardType # Enum: SCREENING, REVIEW, APPROVAL, POST_MORTEM, etc. for scorecard purpose
22-
challengeTrack ChallengeTrack # Enum: DEVELOPMENT, DATA_SCIENCE, DESIGN, QUALITY_ASSURANCE tracking challenge domain
23-
challengeType String? # Optional field specifying type of challenge (e.g., 'coding', 'design')
24-
name String # Display name of the scorecard
25-
version String # Version identifier for the scorecard template
26-
minScore Float # Minimum possible score value for this scorecard
27-
maxScore Float? # Optional maximum possible score value (if not set, use defaults)
28-
createdAt DateTime @default(now()) # Timestamp of creation
29-
createdBy String # ID or handle of user who created the scorecard
30-
updatedAt DateTime # Timestamp for last update
31-
updatedBy String # User ID or handle making changes
18+
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14)
19+
legacyId String?
20+
status ScorecardStatus
21+
type ScorecardType
22+
challengeTrack ChallengeTrack
23+
challengeType String
24+
name String
25+
version String
26+
minScore Float
27+
maxScore Float
28+
createdAt DateTime @default(now())
29+
createdBy String
30+
updatedAt DateTime @updatedAt
31+
updatedBy String
32+
33+
scorecardGroups scorecardGroup[]
34+
reviews review[]
3235
3336
// Indexes for faster searches
34-
@@index([challengeTrack]) # Index on challenge track enum for filtering by domain
35-
@@index([challengeType]) # Index on optional challenge type field (if present, enables fast lookups)
36-
@@index([name]) # Index on display name to improve search performance
37-
38-
// Additional indexes specific to relationships and common queries:
39-
@@index([id]) # Standard index for direct ID lookups
40-
@@index([type]) # Index for filtering by scorecard type (e.g., 'REVIEW')
41-
@@index([status]) # Index for efficient status-based filtering
42-
43-
// Relations: a scorecard can have multiple groups and reviews
44-
scorecardGroups scorecardGroup[] # One-to-many relation with scorecardGroup model
45-
reviews review[] # One-to-many relation with review model (each review belongs to one scorecard)
46-
37+
@@index([challengeTrack])
38+
@@index([challengeType])
39+
@@index([name])
40+
@@index([id]) // Index for direct ID lookups
41+
@@index([type]) // Index for filtering by scorecard type
42+
@@index([status]) // Index for filtering by status (e.g. ACTIVE scorecards)
4743
}
4844

4945
enum ScorecardStatus {
@@ -71,29 +67,23 @@ enum ChallengeTrack {
7167
}
7268

7369
model scorecardGroup {
74-
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14) # Auto-generated ID using nanoid()
75-
legacyId String? # Optional historical identifier
76-
scorecardId String # References the parent scorecard's ID (one-to-one relation)
77-
name String # Name of this group within a scorecard
78-
weight Float # Weightage assigned to this group in percentage terms
79-
sortOrder Int # Order position for sorting sections/ questions
80-
createdAt DateTime @default(now()) # Timestamp when record was created
81-
createdBy String # User who created this scorecard group
82-
updatedAt DateTime # Automatic timestamp on each update
83-
updatedBy String # User making the most recent change
84-
85-
// Relation with parent scorecard (using nanoid() for unique ID)
86-
scorecardId: String @unique # Unique constraint to maintain relation integrity
87-
scorecard scorecard @relation(fields: [scorecardId], references: [id], onDelete: Cascade)
70+
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14)
71+
legacyId String?
72+
scorecardId String
73+
name String
74+
weight Float
75+
sortOrder Int
76+
createdAt DateTime @default(now())
77+
createdBy String
78+
updatedAt DateTime @updatedAt
79+
updatedBy String
8880
89-
// Child relations:
81+
scorecard scorecard @relation(fields: [scorecardId], references: [id], onDelete: Cascade)
9082
sections scorecardSection[]
9183
92-
// Indexes and search optimizations:
93-
@@index([id]) # Standard index for direct ID lookups
94-
@@index([scorecardId]) # Index to join with parent scorecard model efficiently
95-
@@index([sortOrder]) # Index for ordering groups (e.g., by creation time or manual order)
96-
84+
@@index([id]) // Index for direct ID lookups
85+
@@index([scorecardId]) // Index for joining with scorecard table
86+
@@index([sortOrder]) // Index for ordering groups
9787
}
9888

9989
model scorecardSection {
@@ -197,33 +187,24 @@ model reviewItem {
197187
}
198188

199189
model reviewItemComment {
200-
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14) # Auto-generated ID using nanoid()
201-
legacyId String? # Optional historical identifier (from previous systems)
202-
resourceId String # User or resource who authored the comment
203-
reviewItemId String # Links to specific review item being commented on
204-
content String # Actual text/content of the comment
205-
type ReviewItemCommentType # Enum indicating the nature/role of this comment (e.g., 'COMMENT', 'REQUIRED')
206-
sortOrder Int # Default:0; used for ordering comments in UI display
207-
208-
// Timestamps:
209-
createdAt DateTime @default(now()) # Automatic creation timestamp
210-
createdBy String # User who created this review item comment
211-
updatedAt DateTime # Automatic update timestamp on each change
212-
updatedBy String # User making the most recent modification
213-
214-
// Relations to other models:
215-
reviewItemCommentId: String @unique # Unique constraint for relation mapping
216-
217-
reviewItem reviewItem @relation(fields: [reviewItemId], references: [id]) # Relation to specific review item (one-to-one)
218-
219-
// Optional relations:
220-
appeal appeal? # One-to-zero-or-one relation with an appeal comment
221-
222-
// Indexes for search and filtering performance:
223-
@@index([reviewItemId]) # Optimizes joins and queries by review item ID
224-
@@index([id]) # Standard index for direct lookups by ID
225-
@@index([resourceId]) # Enables faster queries by resource (commenter) or user
226-
190+
id String @id @default(dbgenerated("nanoid()")) @db.VarChar(14)
191+
legacyId String?
192+
resourceId String
193+
reviewItemId String
194+
content String
195+
type ReviewItemCommentType
196+
sortOrder Int @default(0)
197+
createdAt DateTime @default(now())
198+
createdBy String
199+
updatedAt DateTime @updatedAt
200+
updatedBy String
201+
202+
reviewItem reviewItem @relation(fields: [reviewItemId], references: [id], onDelete: Cascade)
203+
appeal appeal?
204+
@@index([reviewItemId]) // Index for joining with reviewItem table
205+
@@index([id]) // Index for direct ID lookups
206+
@@index([resourceId]) // Index for filtering by resource (commenter)
207+
@@index([type]) // Index for filtering by comment type
227208
}
228209

229210
enum ReviewItemCommentType {

0 commit comments

Comments
 (0)