savage-tracking/prisma/schema.prisma

76 lines
1.6 KiB
Text
Raw Normal View History

2023-12-21 08:24:14 -08:00
// 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"
2024-01-01 01:06:30 -08:00
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
2023-12-21 08:24:14 -08:00
}
datasource db {
2024-01-01 01:06:30 -08:00
provider = "postgresql"
2023-12-21 08:24:14 -08:00
url = env("DATABASE_URL")
}
2023-12-21 08:24:25 -08:00
model User {
2023-12-21 08:24:14 -08:00
id Int @id @default(autoincrement())
2023-12-21 08:24:25 -08:00
grade Int?
class String?
2023-12-21 08:24:14 -08:00
name String
2023-12-30 10:28:09 -08:00
dname String
2023-12-21 08:24:25 -08:00
username String @unique
password String
2023-12-22 09:54:27 -08:00
rfid String? @unique
2023-12-21 08:24:25 -08:00
isAdmin Boolean @default(false)
2023-12-22 09:54:27 -08:00
rosterOnly Boolean @default(false)
2023-12-21 08:24:25 -08:00
periods Period[]
2023-12-30 10:28:09 -08:00
attendance Attendance[]
2023-12-21 08:24:25 -08:00
number Int?
2023-12-21 08:24:14 -08:00
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([name])
}
2023-12-21 08:24:25 -08:00
model TimePeriod {
id Int @id
name String
2023-12-22 09:54:27 -08:00
start String
end String
2023-12-21 08:24:25 -08:00
periods Period[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([id])
}
model Period {
id Int @id @default(autoincrement())
date DateTime
2023-12-30 10:28:09 -08:00
timePeriod TimePeriod @relation(fields: [timePeriodId], references: [id], onDelete: Cascade)
2023-12-21 08:24:25 -08:00
timePeriodId Int
2023-12-30 10:28:09 -08:00
collecting Boolean @default(true)
2023-12-21 08:24:25 -08:00
users User[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([date])
2023-12-30 10:28:09 -08:00
}
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])
2023-12-21 08:24:25 -08:00
}