rht
This commit is contained in:
parent
5954b95742
commit
5c6a3eebda
|
@ -44,10 +44,10 @@ model Term {
|
|||
createdBy String? @map("created_by")
|
||||
depts Department[] @relation("department_term")
|
||||
hasChildren Boolean? @default(false) @map("has_children")
|
||||
posts Post[] @relation("post_term")
|
||||
Plan Plan? @relation(fields: [planId], references: [id])
|
||||
plan Plan? @relation(fields: [planId], references: [id])
|
||||
planId String?
|
||||
Subject Subject? @relation(fields: [subjectId], references: [id])
|
||||
plans Plan[] @relation("plan_term")
|
||||
subject Subject? @relation(fields: [subjectId], references: [id], name: "subject_term")
|
||||
subjectId String?
|
||||
|
||||
@@index([name]) // 对name字段建立索引,以加快基于name的查找速度
|
||||
|
@ -123,8 +123,6 @@ model AppConfig {
|
|||
@@map("app_config")
|
||||
}
|
||||
|
||||
|
||||
|
||||
model Resource {
|
||||
id String @id @default(cuid()) @map("id")
|
||||
title String? @map("title")
|
||||
|
@ -144,8 +142,6 @@ model Resource {
|
|||
isPublic Boolean? @default(true) @map("is_public")
|
||||
owner Staff? @relation(fields: [ownerId], references: [id])
|
||||
ownerId String? @map("owner_id")
|
||||
post Post? @relation(fields: [postId], references: [id])
|
||||
postId String? @map("post_id")
|
||||
|
||||
// 索引
|
||||
@@index([type])
|
||||
|
@ -153,12 +149,10 @@ model Resource {
|
|||
@@map("resource")
|
||||
}
|
||||
|
||||
|
||||
model Department {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
order Float?
|
||||
posts Post[] @relation("post_dept")
|
||||
ancestors DeptAncestry[] @relation("DescendantToAncestor")
|
||||
descendants DeptAncestry[] @relation("AncestorToDescendant")
|
||||
parentId String? @map("parent_id")
|
||||
|
@ -172,13 +166,11 @@ model Department {
|
|||
deptStaffs Staff[] @relation("DeptStaff")
|
||||
terms Term[] @relation("department_term")
|
||||
|
||||
trainPlans TrainPlan[] @relation("TrainPlanDept")
|
||||
|
||||
// watchedPost Post[] @relation("post_watch_dept")
|
||||
hasChildren Boolean? @default(false) @map("has_children")
|
||||
|
||||
planId String?
|
||||
Plan Plan? @relation(fields: [planId], references: [id])
|
||||
plans Plan[] @relation("plan_dept")
|
||||
|
||||
@@index([parentId])
|
||||
@@index([isDomain])
|
||||
|
@ -188,21 +180,18 @@ model Department {
|
|||
}
|
||||
|
||||
model Staff {
|
||||
id String @id @default(cuid())
|
||||
showname String? @map("showname")
|
||||
username String @unique @map("username")
|
||||
avatar String? @map("avatar")
|
||||
password String? @map("password")
|
||||
phoneNumber String? @unique @map("phone_number")
|
||||
age Int? @default(22) @map("age")
|
||||
sex Boolean? @default(true) @map("sex")
|
||||
absent Boolean? @default(false) @map("absent")
|
||||
trainSituations TrainSituation[]
|
||||
position Position? @relation("StaffPosition", fields: [positionId], references: [id])
|
||||
positionId String? @map("position_id")
|
||||
|
||||
domainId String? @map("domain_id")
|
||||
deptId String? @map("dept_id")
|
||||
id String @id @default(cuid())
|
||||
showname String? @map("showname")
|
||||
username String @unique @map("username")
|
||||
avatar String? @map("avatar")
|
||||
password String? @map("password")
|
||||
phoneNumber String? @unique @map("phone_number")
|
||||
age Int? @default(22) @map("age")
|
||||
gender Int? @default(1) @map("gender")
|
||||
absent Boolean? @default(false) @map("absent")
|
||||
subjects Subject[] @relation("staff_subject")
|
||||
domainId String? @map("domain_id")
|
||||
deptId String? @map("dept_id")
|
||||
|
||||
domain Department? @relation("DomainStaff", fields: [domainId], references: [id])
|
||||
department Department? @relation("DeptStaff", fields: [deptId], references: [id])
|
||||
|
@ -215,17 +204,10 @@ model Staff {
|
|||
officerId String? @map("officer_id")
|
||||
|
||||
// watchedPost Post[] @relation("post_watch_staff")
|
||||
visits Visit[]
|
||||
posts Post[]
|
||||
|
||||
learningPosts Post[] @relation("post_student")
|
||||
sentMsgs Message[] @relation("message_sender")
|
||||
receivedMsgs Message[] @relation("message_receiver")
|
||||
registerToken String?
|
||||
enrollments Enrollment[]
|
||||
teachedPosts PostInstructor[]
|
||||
ownedResources Resource[]
|
||||
Plan Plan[]
|
||||
plans Plan[]
|
||||
|
||||
@@index([officerId])
|
||||
@@index([deptId])
|
||||
|
@ -235,8 +217,6 @@ model Staff {
|
|||
@@map("staff")
|
||||
}
|
||||
|
||||
|
||||
|
||||
model Plan {
|
||||
id String @id @default(cuid())
|
||||
authorId String? @map("author_id")
|
||||
|
@ -247,12 +227,13 @@ model Plan {
|
|||
updatedAt DateTime @map("updated_at")
|
||||
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
|
||||
|
||||
terms Term[] @relation("plan_term")
|
||||
month DateTime @map("month")
|
||||
week DateTime @map("week")
|
||||
checked Boolean @default(false) @map("checked")
|
||||
depts Department[] @relation("plan_dept")
|
||||
meta Json? @map("meta") // 计划表
|
||||
terms Term[] @relation("plan_term")
|
||||
month DateTime @map("month")
|
||||
week DateTime @map("week")
|
||||
checked Boolean @default(false) @map("checked")
|
||||
depts Department[] @relation("plan_dept")
|
||||
meta Json? @map("meta") // 计划表
|
||||
termRelations Term[]
|
||||
|
||||
@@map("plan")
|
||||
}
|
||||
|
@ -266,6 +247,7 @@ model Subject {
|
|||
children Subject[] @relation("SubjectChildren") // 子级帖子列表,关联 Post 模型
|
||||
ancestors SubjectAncestry[] @relation("DescendantToAncestor")
|
||||
descendants SubjectAncestry[] @relation("AncestorToDescendant")
|
||||
staffs Staff[] @relation("staff_subject")
|
||||
|
||||
@@map("subject")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue