sdy

update prisma schema

......@@ -9,20 +9,19 @@ datasource db {
}
model User {
id Int @default(autoincrement()) @id
avatarUrl String? @default("")
email String @unique
password String
name String
phoneNum String @default("") @unique
emailSecret String? @default("")
phoneSecret String? @default("")
bio String? @default("")
rooms Room[] @relation(references: [id])
messages Message[]
sender Message @relation("Sender")
receiver Message[] @relation("Receiver")
createdAt DateTime? @default(now())
id Int @default(autoincrement()) @id
avatarUrl String? @default("")
email String @unique
password String
name String
phoneNum String @default("") @unique
emailSecret String? @default("")
phoneSecret String? @default("")
bio String? @default("")
rooms Room[] @relation(references: [id])
sendMessage Message[] @relation("Sender")
receiveMessage Message[] @relation("Receiver")
createdAt DateTime? @default(now())
}
model Room {
......@@ -40,12 +39,9 @@ model Category {
model Message {
id Int @default(autoincrement()) @id
text String? @default("")
from User @relation("Sender", fields: [fromId], references: [id])
fromId Int
to User @relation("Receiver", fields: [toId], references: [id])
toId Int
from User[] @relation("Sender", references: [id])
to User[] @relation("Receiver", references: [id])
room Room @relation(fields: [roomId], references: [id])
roomId Int
createdAt DateTime?
userId Int?
createdAt DateTime? @default(now())
}
\ No newline at end of file
......