mirror of
https://github.com/aaronleetw/savage-tracking.git
synced 2024-11-14 19:11:39 -08:00
75 lines
No EOL
1.6 KiB
Text
75 lines
No EOL
1.6 KiB
Text
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
grade Int?
|
|
class String?
|
|
name String
|
|
dname String
|
|
username String @unique
|
|
password String
|
|
rfid String? @unique
|
|
isAdmin Boolean @default(false)
|
|
rosterOnly Boolean @default(false)
|
|
|
|
periods Period[]
|
|
attendance Attendance[]
|
|
|
|
number Int?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([name])
|
|
}
|
|
|
|
model TimePeriod {
|
|
id Int @id
|
|
name String
|
|
|
|
start String
|
|
end String
|
|
|
|
periods Period[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([id])
|
|
}
|
|
|
|
model Period {
|
|
id Int @id @default(autoincrement())
|
|
date DateTime
|
|
timePeriod TimePeriod @relation(fields: [timePeriodId], references: [id], onDelete: Cascade)
|
|
timePeriodId Int
|
|
collecting Boolean @default(true)
|
|
|
|
users User[]
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([date])
|
|
}
|
|
|
|
model Attendance {
|
|
id Int @id @default(autoincrement())
|
|
datetime DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId Int
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([datetime])
|
|
} |