123
This commit is contained in:
@@ -324,6 +324,8 @@ model UserRole {
|
||||
model Comment {
|
||||
id String @id @default(cuid())
|
||||
postId String
|
||||
parentId String? // 부모 댓글 ID (null이면 최상위 댓글)
|
||||
depth Int @default(0) // 댓글 깊이 (0=최상위, 1=1단계 대댓글, 2=2단계 대댓글)
|
||||
authorId String?
|
||||
content String
|
||||
isAnonymous Boolean @default(false)
|
||||
@@ -332,11 +334,14 @@ model Comment {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
||||
author User? @relation(fields: [authorId], references: [userId], onDelete: SetNull)
|
||||
reports Report[]
|
||||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
||||
parent Comment? @relation("CommentReplies", fields: [parentId], references: [id], onDelete: Cascade)
|
||||
replies Comment[] @relation("CommentReplies")
|
||||
author User? @relation(fields: [authorId], references: [userId], onDelete: SetNull)
|
||||
reports Report[]
|
||||
|
||||
@@index([postId, createdAt])
|
||||
@@index([parentId])
|
||||
@@map("comments")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user