sdy

update schema.prisma

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