savage-tracking/prisma/schema.prisma
2023-12-22 00:24:25 +08:00

54 lines
No EOL
1.1 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
username String @unique
password String
isAdmin Boolean @default(false)
periods Period[]
number Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([name])
}
model TimePeriod {
id Int @id
name 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])
timePeriodId Int
users User[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([date])
}