Showing
1 changed file
with
5 additions
and
9 deletions
... | @@ -19,9 +19,8 @@ model User { | ... | @@ -19,9 +19,8 @@ model User { |
19 | phoneSecret String? @default("") | 19 | phoneSecret String? @default("") |
20 | bio String? @default("") | 20 | bio String? @default("") |
21 | rooms Room[] @relation(references: [id]) | 21 | rooms Room[] @relation(references: [id]) |
22 | - messages Message[] | 22 | + sendMessage Message[] @relation("Sender") |
23 | - sender Message @relation("Sender") | 23 | + receiveMessage Message[] @relation("Receiver") |
24 | - receiver Message[] @relation("Receiver") | ||
25 | createdAt DateTime? @default(now()) | 24 | createdAt DateTime? @default(now()) |
26 | } | 25 | } |
27 | 26 | ||
... | @@ -40,12 +39,9 @@ model Category { | ... | @@ -40,12 +39,9 @@ model Category { |
40 | model Message { | 39 | model Message { |
41 | id Int @default(autoincrement()) @id | 40 | id Int @default(autoincrement()) @id |
42 | text String? @default("") | 41 | text String? @default("") |
43 | - from User @relation("Sender", fields: [fromId], references: [id]) | 42 | + from User[] @relation("Sender", references: [id]) |
44 | - fromId Int | 43 | + to User[] @relation("Receiver", references: [id]) |
45 | - to User @relation("Receiver", fields: [toId], references: [id]) | ||
46 | - toId Int | ||
47 | room Room @relation(fields: [roomId], references: [id]) | 44 | room Room @relation(fields: [roomId], references: [id]) |
48 | roomId Int | 45 | roomId Int |
49 | - createdAt DateTime? | 46 | + createdAt DateTime? @default(now()) |
50 | - userId Int? | ||
51 | } | 47 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment