69 lines
3.4 KiB
Text
69 lines
3.4 KiB
Text
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model news {
|
|
id Int @id(map: "pk_news") @default(autoincrement())
|
|
title String
|
|
message String
|
|
is_alert Boolean @default(false)
|
|
created_at DateTime @default(now())
|
|
}
|
|
|
|
model study_item {
|
|
id Int @id(map: "pk_study_item") @default(autoincrement())
|
|
title String
|
|
study_slot study_slot[]
|
|
}
|
|
|
|
model study_slot {
|
|
id Int @id(map: "pk_study_slot") @default(autoincrement())
|
|
study_item_id Int?
|
|
study_item study_item? @relation(fields: [study_item_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_study_slot_study_item")
|
|
timetable_timetable_slot_1Tostudy_slot timetable[] @relation("timetable_slot_1Tostudy_slot")
|
|
timetable_timetable_slot_2Tostudy_slot timetable[] @relation("timetable_slot_2Tostudy_slot")
|
|
timetable_timetable_slot_3Tostudy_slot timetable[] @relation("timetable_slot_3Tostudy_slot")
|
|
timetable_timetable_slot_4Tostudy_slot timetable[] @relation("timetable_slot_4Tostudy_slot")
|
|
timetable_timetable_slot_5Tostudy_slot timetable[] @relation("timetable_slot_5Tostudy_slot")
|
|
timetable_timetable_slot_6Tostudy_slot timetable[] @relation("timetable_slot_6Tostudy_slot")
|
|
}
|
|
|
|
model timetable {
|
|
id Int @id(map: "pk_timetable") @default(autoincrement())
|
|
slot_1 Int?
|
|
slot_2 Int?
|
|
slot_3 Int?
|
|
slot_4 Int?
|
|
slot_5 Int?
|
|
slot_6 Int?
|
|
day Int @db.SmallInt
|
|
teacher Int
|
|
study_slot_timetable_slot_1Tostudy_slot study_slot? @relation("timetable_slot_1Tostudy_slot", fields: [slot_1], references: [id], map: "fk_timetable_study_slot_1")
|
|
study_slot_timetable_slot_2Tostudy_slot study_slot? @relation("timetable_slot_2Tostudy_slot", fields: [slot_2], references: [id], map: "fk_timetable_study_slot_2")
|
|
study_slot_timetable_slot_3Tostudy_slot study_slot? @relation("timetable_slot_3Tostudy_slot", fields: [slot_3], references: [id], map: "fk_timetable_study_slot_3")
|
|
study_slot_timetable_slot_4Tostudy_slot study_slot? @relation("timetable_slot_4Tostudy_slot", fields: [slot_4], references: [id], map: "fk_timetable_study_slot_4")
|
|
study_slot_timetable_slot_5Tostudy_slot study_slot? @relation("timetable_slot_5Tostudy_slot", fields: [slot_5], references: [id], map: "fk_timetable_study_slot_5")
|
|
study_slot_timetable_slot_6Tostudy_slot study_slot? @relation("timetable_slot_6Tostudy_slot", fields: [slot_6], references: [id], map: "fk_timetable_study_slot_6")
|
|
users users @relation(fields: [teacher], references: [id], onDelete: Cascade, map: "fk_timetable_users_teacher")
|
|
}
|
|
|
|
model users {
|
|
id Int @id(map: "pk_users") @default(autoincrement())
|
|
login String @unique @db.VarChar(25)
|
|
pass String @db.VarChar(100)
|
|
is_admin Boolean @default(false)
|
|
timetable timetable[]
|
|
user_session user_session[]
|
|
}
|
|
|
|
model user_session {
|
|
id String @id @default(uuid())
|
|
usersId Int
|
|
|
|
user users @relation(fields: [usersId], references: [id])
|
|
}
|