sdy

update schema.prisma

......@@ -18,27 +18,27 @@ model User {
emailSecret String? @default("")
phoneSecret String? @default("")
bio String? @default("")
rooms Room[] @relation(references: [id])
groups Group[] @relation(references: [id])
messages Message[]
sender User[] @relation("SenderReceiver", references: [id])
receiver User[] @relation("SenderReceiver", references: [id])
directMessages DirectMessage[]
createdAt DateTime? @default(now())
}
model Room {
model Group {
id Int @default(autoincrement()) @id
name String @unique
participants User[] @relation(references: [id])
categories Category[]
participants User[]
messages Message[]
files String? @default("")
createdAt DateTime? @default(now())
}
model Category {
model DirectMessage {
id Int @default(autoincrement()) @id
name String @default("") @unique
room Room @relation(fields: [roomId], references: [id])
roomId Int
messages Message[]
text String @default("")
sender User @relation(fields: [senderId], references: [id])
senderId Int
createdAt DateTime? @default(now())
}
model Message {
......@@ -46,9 +46,7 @@ model Message {
text String @default("")
sender User @relation(fields: [senderId], references: [id])
senderId Int
room Room @relation(fields: [roomId], references: [id])
roomId Int
group Group @relation(fields: [groupId], references: [id])
groupId Int
createdAt DateTime? @default(now())
category Category? @relation(fields: [categoryId], references: [id])
categoryId Int?
}
......