Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update schema.prisma #519

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 49 additions & 42 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Updated Prisma schema with additional features

generator client {
provider = "prisma-client-js"
Expand All @@ -11,61 +10,69 @@ datasource db {
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}

// Added enum for role to ensure predefined roles
enum UserRole {
ADMIN
TEACHER
STUDENT
NONE
}

model Classroom {
classroomId String @id @default(cuid())
classroomName String
fccUserIds String[]
description String?
fccCertifications Int[]
classroomTeacherId String
User User @relation(fields: [classroomTeacherId], references: [id])
createdAt DateTime @default(now())
}
classroomId String @id @default(auto()) @map("_id") @test.Auto(1)
classroomName String
fccUserIds String[]
description String?
fccCertifications Int[]
classroomTeacherId String
User User @relation(fields: [classroomTeacherId], references: [id])
createdAt DateTime @default(now())
}

model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
id String @id @default(auto()) @map("_id") @test.Auto(2)
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
refresh_token_expires_in Int?

user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@unique([provider, providerAccountId])
}

model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
id String @id @default(auto()) @map("_id") @test.Auto(3)
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
role String @default("NONE")
Classroom Classroom[]
accounts Account[]
sessions Session[]
id String @id @default(auto()) @map("_id") @test.Auto(4)
name String?
email String? @unique
emailVerified DateTime?
image String?
role UserRole @default(NONE)
Classrooms Classroom[]
accounts Account[]
sessions Session[]
}

model VerificationToken {
identifier String
token String @unique
expires DateTime
identifier String
token String @unique
expires DateTime

@@unique([identifier, token])
}
}