model Comment {
id Int @id @default(autoincrement())
title String @default("Untitled")
content String @default("")
hashtags String[] @default([])
// author
author User @relation(fields: [authorId], references: [authId])
authorId String
// replies -
replyToId Int? @default(autoincrement())
replyTo Comment? @relation("replies", fields: [replyToId], references: [id], onDelete: NoAction, onUpdate: NoAction)
replies Comment[] @relation("replies")
// media files
mediaFiles MediaFile[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model MediaFile {
id Int @id @default(autoincrement())
url String
providerPublicId String?
key String?
// user
user User @relation(fields: [userId], references: [authId])
userId String
// comments
comment Comment? @relation(fields: [commentId], references: [id])
commentId Int? @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}