Skip to content

Commit 9285030

Browse files
committed
added chat attachment model to prisma schema
1 parent af121ff commit 9285030

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

packages/db/prisma/schema.prisma

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ model User {
290290
chatSessions ChatSession[]
291291
chatMessages ChatMessage[]
292292
chatToolCalls ChatToolCall[]
293+
chatAttachments ChatAttachment[]
293294
sentInvitations Invitation[] @relation("InvitedByUser")
294295
commentMentions CommentMention[] @relation("commentMentions")
295296
notificationPreferences NotificationPreference[]
@@ -550,11 +551,30 @@ model ChatMessage {
550551
createdAt DateTime @default(now())
551552
toolCallRows ChatToolCall[]
552553
554+
attachments ChatAttachment[]
555+
553556
@@index([sessionId, createdAt])
554557
@@index([userId, createdAt])
555558
@@map("chat_messages")
556559
}
557560

561+
model ChatAttachment {
562+
id String @id @default(uuid())
563+
messageId String?
564+
message ChatMessage? @relation(fields: [messageId], references: [id], onDelete: Cascade)
565+
userId String
566+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
567+
filename String
568+
mimeType String
569+
url String
570+
size Int
571+
createdAt DateTime @default(now())
572+
573+
@@index([messageId])
574+
@@index([userId, createdAt])
575+
@@map("chat_attachments")
576+
}
577+
558578
model ChatToolCall {
559579
id String @id @default(uuid())
560580
sessionId String

0 commit comments

Comments
 (0)