sdy

update prisma schema

...@@ -28,6 +28,7 @@ model Room { ...@@ -28,6 +28,7 @@ model Room {
28 id Int @default(autoincrement()) @id 28 id Int @default(autoincrement()) @id
29 participants User[] @relation(references: [id]) 29 participants User[] @relation(references: [id])
30 categories Category[] @relation(references: [id]) 30 categories Category[] @relation(references: [id])
31 + Message Message[]
31 } 32 }
32 33
33 model Category { 34 model Category {
...@@ -39,8 +40,10 @@ model Category { ...@@ -39,8 +40,10 @@ model Category {
39 model Message { 40 model Message {
40 id Int @default(autoincrement()) @id 41 id Int @default(autoincrement()) @id
41 text String? @default("") 42 text String? @default("")
42 - from User[] @relation("Sender", references: [id]) 43 + from User @relation("Sender", fields: [fromId], references: [id])
43 - to User[] @relation("Receiver", references: [id]) 44 + fromId Int
45 + to User? @relation("Receiver", fields: [toId], references: [id])
46 + toId Int?
44 room Room @relation(fields: [roomId], references: [id]) 47 room Room @relation(fields: [roomId], references: [id])
45 roomId Int 48 roomId Int
46 createdAt DateTime? @default(now()) 49 createdAt DateTime? @default(now())
......