Server/prisma/schema.prisma

65 lines
1.4 KiB
Plaintext
Raw Normal View History

2024-11-25 12:17:49 +00:00
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
2024-11-25 12:17:49 +00:00
url = env("DATABASE_URL")
}
model User {
id String @id @default(cuid())
username String?
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
TEACHER
2024-11-25 12:17:49 +00:00
}