sdy

update prisma schema

......@@ -19,9 +19,8 @@ model User {
phoneSecret String? @default("")
bio String? @default("")
rooms Room[] @relation(references: [id])
messages Message[]
sender Message @relation("Sender")
receiver Message[] @relation("Receiver")
sendMessage Message[] @relation("Sender")
receiveMessage Message[] @relation("Receiver")
createdAt DateTime? @default(now())
}
......@@ -40,12 +39,9 @@ model Category {
model Message {
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
from User[] @relation("Sender", references: [id])
to User[] @relation("Receiver", references: [id])
room Room @relation(fields: [roomId], references: [id])
roomId Int
createdAt DateTime?
userId Int?
createdAt DateTime? @default(now())
}
\ No newline at end of file
......