Server/prisma/schema.prisma
2024-12-02 13:57:47 +01:00

65 lines
1.4 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
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
ADMIN
}