2024-11-25 12:17:49 +00:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
2024-11-28 23:26:37 +00:00
|
|
|
provider = "mysql"
|
2024-11-25 12:17:49 +00:00
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
username String?
|
2024-11-28 23:26:37 +00:00
|
|
|
role Role @default(STUDENT)
|
|
|
|
|
|
|
|
Class Class[]
|
|
|
|
SentMessages UserMessage[] @relation("SentMessages")
|
|
|
|
ReceivedMessages UserMessage[] @relation("ReceivedMessages")
|
|
|
|
}
|
|
|
|
|
|
|
|
model UserMessage {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
|
|
|
|
sender User @relation(fields: [sender_user_Id], references: [id], name: "SentMessages")
|
|
|
|
sender_user_Id String
|
|
|
|
|
|
|
|
receiver User @relation(fields: [receiver_user_Id], references: [id], name: "ReceivedMessages")
|
|
|
|
receiver_user_Id String
|
|
|
|
}
|
|
|
|
|
|
|
|
model Class {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
name String
|
|
|
|
|
|
|
|
ClassRoom Room[]
|
|
|
|
students User[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Room {
|
|
|
|
id String @id @default(cuid())
|
|
|
|
name String
|
|
|
|
class Class[]
|
|
|
|
Messages RoomMessage[]
|
|
|
|
Documents RoomDocument[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model RoomMessage {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
Room Room @relation(fields: [roomId], references: [id])
|
|
|
|
roomId String
|
|
|
|
}
|
|
|
|
|
|
|
|
model RoomDocument {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
content String
|
|
|
|
Room Room @relation(fields: [roomId], references: [id])
|
|
|
|
roomId String
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Role {
|
|
|
|
STUDENT
|
2024-12-02 12:57:47 +00:00
|
|
|
ADMIN
|
2024-11-25 12:17:49 +00:00
|
|
|
}
|