sdy

add creator column

...@@ -18,7 +18,8 @@ model User { ...@@ -18,7 +18,8 @@ model User {
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 - groups Group[] @relation(references: [id]) 21 + participatedGroup Group[] @relation("group-participants", references: [id])
22 + createdGroup Group[] @relation("group-creator")
22 messages Message[] 23 messages Message[]
23 directMessages DirectMessage[] 24 directMessages DirectMessage[]
24 createdAt DateTime? @default(now()) 25 createdAt DateTime? @default(now())
...@@ -27,8 +28,10 @@ model User { ...@@ -27,8 +28,10 @@ model User {
27 model Group { 28 model Group {
28 id Int @default(autoincrement()) @id 29 id Int @default(autoincrement()) @id
29 name String @unique 30 name String @unique
30 - participants User[] 31 + participants User[] @relation("group-participants")
31 messages Message[] 32 messages Message[]
33 + creator User @relation("group-creator", fields: [creatorId])
34 + creatorId Int
32 files String? @default("") 35 files String? @default("")
33 createdAt DateTime? @default(now()) 36 createdAt DateTime? @default(now())
34 } 37 }
......