Compare commits
2 Commits
2acc55e58d
...
181e8c995d
| Author | SHA1 | Date |
|---|---|---|
|
|
181e8c995d | |
|
|
5c6a3eebda |
|
|
@ -44,11 +44,12 @@ model Term {
|
||||||
createdBy String? @map("created_by")
|
createdBy String? @map("created_by")
|
||||||
depts Department[] @relation("department_term")
|
depts Department[] @relation("department_term")
|
||||||
hasChildren Boolean? @default(false) @map("has_children")
|
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?
|
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?
|
subjectId String?
|
||||||
|
trainPlans TrainPlan[] @relation("TrainPlanTerm")
|
||||||
|
|
||||||
@@index([name]) // 对name字段建立索引,以加快基于name的查找速度
|
@@index([name]) // 对name字段建立索引,以加快基于name的查找速度
|
||||||
@@index([parentId]) // 对parentId字段建立索引,以加快基于parentId的查找速度
|
@@index([parentId]) // 对parentId字段建立索引,以加快基于parentId的查找速度
|
||||||
|
|
@ -142,8 +143,6 @@ model Resource {
|
||||||
isPublic Boolean? @default(true) @map("is_public")
|
isPublic Boolean? @default(true) @map("is_public")
|
||||||
owner Staff? @relation(fields: [ownerId], references: [id])
|
owner Staff? @relation(fields: [ownerId], references: [id])
|
||||||
ownerId String? @map("owner_id")
|
ownerId String? @map("owner_id")
|
||||||
post Post? @relation(fields: [postId], references: [id])
|
|
||||||
postId String? @map("post_id")
|
|
||||||
|
|
||||||
// 索引
|
// 索引
|
||||||
@@index([type])
|
@@index([type])
|
||||||
|
|
@ -155,7 +154,6 @@ model Department {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
name String
|
name String
|
||||||
order Float?
|
order Float?
|
||||||
posts Post[] @relation("post_dept")
|
|
||||||
ancestors DeptAncestry[] @relation("DescendantToAncestor")
|
ancestors DeptAncestry[] @relation("DescendantToAncestor")
|
||||||
descendants DeptAncestry[] @relation("AncestorToDescendant")
|
descendants DeptAncestry[] @relation("AncestorToDescendant")
|
||||||
parentId String? @map("parent_id")
|
parentId String? @map("parent_id")
|
||||||
|
|
@ -169,13 +167,11 @@ model Department {
|
||||||
deptStaffs Staff[] @relation("DeptStaff")
|
deptStaffs Staff[] @relation("DeptStaff")
|
||||||
terms Term[] @relation("department_term")
|
terms Term[] @relation("department_term")
|
||||||
|
|
||||||
trainPlans TrainPlan[] @relation("TrainPlanDept")
|
|
||||||
|
|
||||||
// watchedPost Post[] @relation("post_watch_dept")
|
// watchedPost Post[] @relation("post_watch_dept")
|
||||||
hasChildren Boolean? @default(false) @map("has_children")
|
hasChildren Boolean? @default(false) @map("has_children")
|
||||||
|
|
||||||
planId String?
|
planId String?
|
||||||
Plan Plan? @relation(fields: [planId], references: [id])
|
plans Plan[] @relation("plan_dept")
|
||||||
|
|
||||||
@@index([parentId])
|
@@index([parentId])
|
||||||
@@index([isDomain])
|
@@index([isDomain])
|
||||||
|
|
@ -192,12 +188,9 @@ model Staff {
|
||||||
password String? @map("password")
|
password String? @map("password")
|
||||||
phoneNumber String? @unique @map("phone_number")
|
phoneNumber String? @unique @map("phone_number")
|
||||||
age Int? @default(22) @map("age")
|
age Int? @default(22) @map("age")
|
||||||
sex Boolean? @default(true) @map("sex")
|
gender Int? @default(1) @map("gender")
|
||||||
absent Boolean? @default(false) @map("absent")
|
absent Boolean? @default(false) @map("absent")
|
||||||
trainSituations TrainSituation[]
|
subjects Subject[] @relation("staff_subject")
|
||||||
position Position? @relation("StaffPosition", fields: [positionId], references: [id])
|
|
||||||
positionId String? @map("position_id")
|
|
||||||
|
|
||||||
domainId String? @map("domain_id")
|
domainId String? @map("domain_id")
|
||||||
deptId String? @map("dept_id")
|
deptId String? @map("dept_id")
|
||||||
|
|
||||||
|
|
@ -212,17 +205,10 @@ model Staff {
|
||||||
officerId String? @map("officer_id")
|
officerId String? @map("officer_id")
|
||||||
|
|
||||||
// watchedPost Post[] @relation("post_watch_staff")
|
// 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?
|
registerToken String?
|
||||||
enrollments Enrollment[]
|
|
||||||
teachedPosts PostInstructor[]
|
|
||||||
ownedResources Resource[]
|
ownedResources Resource[]
|
||||||
Plan Plan[]
|
plans Plan[]
|
||||||
|
|
||||||
@@index([officerId])
|
@@index([officerId])
|
||||||
@@index([deptId])
|
@@index([deptId])
|
||||||
|
|
@ -243,9 +229,11 @@ model Plan {
|
||||||
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
|
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
|
||||||
|
|
||||||
terms Term[] @relation("plan_term")
|
terms Term[] @relation("plan_term")
|
||||||
|
termRefs Term[]
|
||||||
checked Boolean @default(false) @map("checked")
|
checked Boolean @default(false) @map("checked")
|
||||||
depts Department[] @relation("plan_dept")
|
depts Department[] @relation("plan_dept")
|
||||||
meta Json? @map("meta") // 计划表
|
meta Json? @map("meta") // 计划表
|
||||||
|
trainPlans TrainPlan[]
|
||||||
|
|
||||||
@@map("plan")
|
@@map("plan")
|
||||||
}
|
}
|
||||||
|
|
@ -287,6 +275,7 @@ model Subject {
|
||||||
children Subject[] @relation("SubjectChildren") // 子级帖子列表,关联 Post 模型
|
children Subject[] @relation("SubjectChildren") // 子级帖子列表,关联 Post 模型
|
||||||
ancestors SubjectAncestry[] @relation("DescendantToAncestor")
|
ancestors SubjectAncestry[] @relation("DescendantToAncestor")
|
||||||
descendants SubjectAncestry[] @relation("AncestorToDescendant")
|
descendants SubjectAncestry[] @relation("AncestorToDescendant")
|
||||||
|
staffs Staff[] @relation("staff_subject")
|
||||||
|
|
||||||
@@map("subject")
|
@@map("subject")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue