rht
This commit is contained in:
parent
5954b95742
commit
5c6a3eebda
|
@ -44,10 +44,10 @@ 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?
|
||||||
|
|
||||||
@@index([name]) // 对name字段建立索引,以加快基于name的查找速度
|
@@index([name]) // 对name字段建立索引,以加快基于name的查找速度
|
||||||
|
@ -123,8 +123,6 @@ model AppConfig {
|
||||||
@@map("app_config")
|
@@map("app_config")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
model Resource {
|
model Resource {
|
||||||
id String @id @default(cuid()) @map("id")
|
id String @id @default(cuid()) @map("id")
|
||||||
title String? @map("title")
|
title String? @map("title")
|
||||||
|
@ -144,8 +142,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])
|
||||||
|
@ -153,12 +149,10 @@ model Resource {
|
||||||
@@map("resource")
|
@@map("resource")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
model Department {
|
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")
|
||||||
|
@ -172,13 +166,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])
|
||||||
|
@ -188,21 +180,18 @@ model Department {
|
||||||
}
|
}
|
||||||
|
|
||||||
model Staff {
|
model Staff {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
showname String? @map("showname")
|
showname String? @map("showname")
|
||||||
username String @unique @map("username")
|
username String @unique @map("username")
|
||||||
avatar String? @map("avatar")
|
avatar String? @map("avatar")
|
||||||
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])
|
domainId String? @map("domain_id")
|
||||||
positionId String? @map("position_id")
|
deptId String? @map("dept_id")
|
||||||
|
|
||||||
domainId String? @map("domain_id")
|
|
||||||
deptId String? @map("dept_id")
|
|
||||||
|
|
||||||
domain Department? @relation("DomainStaff", fields: [domainId], references: [id])
|
domain Department? @relation("DomainStaff", fields: [domainId], references: [id])
|
||||||
department Department? @relation("DeptStaff", fields: [deptId], references: [id])
|
department Department? @relation("DeptStaff", fields: [deptId], references: [id])
|
||||||
|
@ -215,17 +204,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])
|
||||||
|
@ -235,8 +217,6 @@ model Staff {
|
||||||
@@map("staff")
|
@@map("staff")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
model Plan {
|
model Plan {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
authorId String? @map("author_id")
|
authorId String? @map("author_id")
|
||||||
|
@ -247,12 +227,13 @@ model Plan {
|
||||||
updatedAt DateTime @map("updated_at")
|
updatedAt DateTime @map("updated_at")
|
||||||
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
|
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
|
||||||
|
|
||||||
terms Term[] @relation("plan_term")
|
terms Term[] @relation("plan_term")
|
||||||
month DateTime @map("month")
|
month DateTime @map("month")
|
||||||
week DateTime @map("week")
|
week DateTime @map("week")
|
||||||
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") // 计划表
|
||||||
|
termRelations Term[]
|
||||||
|
|
||||||
@@map("plan")
|
@@map("plan")
|
||||||
}
|
}
|
||||||
|
@ -266,6 +247,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