94 lines
2.3 KiB
Text
94 lines
2.3 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
|
|
where String
|
|
studentsGroup String
|
|
position Int
|
|
study_item study_item @relation(fields: [study_item_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_study_slot_study_item")
|
|
timetable timetable? @relation(fields: [timetableId], references: [id])
|
|
timetableId Int?
|
|
}
|
|
|
|
model timetable {
|
|
id Int @id(map: "pk_timetable") @default(autoincrement())
|
|
day Int @db.SmallInt
|
|
odd Boolean
|
|
slots study_slot[]
|
|
teacher users @relation(fields: [teacherId], references: [id])
|
|
teacherId Int
|
|
}
|
|
|
|
model users {
|
|
id Int @id(map: "pk_users") @default(autoincrement())
|
|
login String @unique @db.VarChar(25)
|
|
pass String @db.VarChar(100)
|
|
fullName String? @db.VarChar(100)
|
|
is_admin Boolean @default(false)
|
|
is_moderator Boolean @default(false)
|
|
lore String? @db.Text()
|
|
|
|
timetable timetable[]
|
|
user_session user_session[]
|
|
chat_message chat_message[]
|
|
user_in_chat user_in_chat[]
|
|
}
|
|
|
|
model user_session {
|
|
id String @id @default(uuid())
|
|
usersId Int
|
|
|
|
user users @relation(fields: [usersId], references: [id])
|
|
}
|
|
|
|
model chat {
|
|
id String @id @default(uuid())
|
|
title String
|
|
|
|
chat_message chat_message[]
|
|
user_in_chat user_in_chat[]
|
|
}
|
|
|
|
model chat_message {
|
|
id String @id @default(uuid())
|
|
text String
|
|
|
|
user users @relation(fields: [userId], references: [id])
|
|
chat chat @relation(fields: [chatId], references: [id])
|
|
|
|
sendAt DateTime @default(now())
|
|
|
|
chatId String
|
|
userId Int
|
|
}
|
|
|
|
model user_in_chat {
|
|
id Int @id @default(autoincrement())
|
|
chatId String
|
|
userId Int
|
|
|
|
chat chat @relation(fields: [chatId], references: [id])
|
|
user users @relation(fields: [userId], references: [id])
|
|
}
|