mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(prisma): add schema with User and Problem models
This commit is contained in:
parent
0644a9f71f
commit
3f34d9505b
39
prisma/schema.prisma
Normal file
39
prisma/schema.prisma
Normal file
@ -0,0 +1,39 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
ADMIN
|
||||
TEACHER
|
||||
STUDENT
|
||||
GUEST
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
email String @unique
|
||||
role Role @default(GUEST)
|
||||
problems Problem[]
|
||||
}
|
||||
|
||||
enum Difficulty {
|
||||
EASY
|
||||
MEDIUM
|
||||
HARD
|
||||
}
|
||||
|
||||
model Problem {
|
||||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
content String
|
||||
difficulty Difficulty @default(EASY)
|
||||
published Boolean @default(false)
|
||||
authorId Int
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
}
|
Loading…
Reference in New Issue
Block a user