sdy

update prisma schema

......@@ -20,6 +20,8 @@ model User {
bio String? @default("")
rooms Room[] @relation(references: [id])
messages Message[]
sender Message @relation("Sender")
receiver Message[] @relation("Receiver")
createdAt DateTime? @default(now())
}
......@@ -36,8 +38,14 @@ model Category {
}
model Message {
id Int @default(autoincrement()) @id
text String? @default("")
sender User @relation(fields: [senderId], references: [id])
senderId Int
id Int @default(autoincrement()) @id
text String? @default("")
from User @relation("Sender", fields: [fromId], references: [id])
fromId Int
to User @relation("Receiver", fields: [toId], references: [id])
toId Int
room Room @relation(fields: [roomId], references: [id])
roomId Int
createdAt DateTime?
userId Int?
}
\ No newline at end of file
......