sdy

update prisma schema

...@@ -9,20 +9,19 @@ datasource db { ...@@ -9,20 +9,19 @@ datasource db {
9 } 9 }
10 10
11 model User { 11 model User {
12 - id Int @default(autoincrement()) @id 12 + id Int @default(autoincrement()) @id
13 - avatarUrl String? @default("") 13 + avatarUrl String? @default("")
14 - email String @unique 14 + email String @unique
15 - password String 15 + password String
16 - name String 16 + name String
17 - phoneNum String @default("") @unique 17 + phoneNum String @default("") @unique
18 - emailSecret String? @default("") 18 + emailSecret String? @default("")
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") 24 + createdAt DateTime? @default(now())
25 - createdAt DateTime? @default(now())
26 } 25 }
27 26
28 model Room { 27 model Room {
...@@ -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
......