docs(platform): Add database documentation system and restructure deployment docs
Completed: - Add 6 core database documents (docs/01-平台基础层/07-数据库/) Architecture overview, migration history, environment comparison, tech debt tracking, seed data management, PostgreSQL extensions - Restructure deployment docs: archive 20 legacy files to _archive-2025/ - Create unified daily operations manual (01-日常更新操作手册.md) - Add pending deployment change tracker (03-待部署变更清单.md) - Update database development standard to v3.0 (three iron rules) - Fix Prisma schema type drift: align @db.* annotations with actual DB IIT: UUID/Timestamptz(6), SSA: Timestamp(6)/VarChar(20/50/100) - Add migration: 20260227_align_schema_with_db_types (idempotent ALTER) - Add Cursor Rule for auto-reminding deployment change documentation - Update system status guide v6.4 with deployment and DB doc references - Add architecture consultation docs (Prisma guide, SAE deployment guide) Technical details: - Manual migration due to shadow DB limitation (TD-001 in tech debt) - Deployment docs reduced from 20+ scattered files to 3 core documents - Cursor Rule triggers on schema.prisma, package.json, Dockerfile changes Made-with: Cursor
This commit is contained in:
@@ -1430,7 +1430,8 @@ model IitQcProjectStats {
|
||||
|
||||
/// eQuery 表 - AI 自动生成的电子质疑,具有完整生命周期
|
||||
model IitEquery {
|
||||
id String @id @default(uuid())
|
||||
// TODO: Tech Debt - DB 由 prisma db push 创建为 UUID 类型,未来大版本重构时统一为 String/TEXT
|
||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||
projectId String @map("project_id")
|
||||
|
||||
// 来源
|
||||
@@ -1452,23 +1453,24 @@ model IitEquery {
|
||||
|
||||
// CRC 回复
|
||||
assignedTo String? @map("assigned_to")
|
||||
respondedAt DateTime? @map("responded_at")
|
||||
// TODO: Tech Debt - DB 由 prisma db push 创建为 TIMESTAMPTZ(6),与 Prisma 默认的 TIMESTAMP(3) 不同
|
||||
respondedAt DateTime? @map("responded_at") @db.Timestamptz(6)
|
||||
responseText String? @map("response_text") @db.Text
|
||||
responseData Json? @map("response_data") @db.JsonB
|
||||
|
||||
// AI 复核
|
||||
reviewResult String? @map("review_result")
|
||||
reviewNote String? @map("review_note") @db.Text
|
||||
reviewedAt DateTime? @map("reviewed_at")
|
||||
reviewedAt DateTime? @map("reviewed_at") @db.Timestamptz(6)
|
||||
|
||||
// 关闭
|
||||
closedAt DateTime? @map("closed_at")
|
||||
closedAt DateTime? @map("closed_at") @db.Timestamptz(6)
|
||||
closedBy String? @map("closed_by")
|
||||
resolution String? @db.Text
|
||||
|
||||
// 时间线
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||
|
||||
@@index([projectId], map: "idx_iit_equery_project")
|
||||
@@index([projectId, status], map: "idx_iit_equery_project_status")
|
||||
@@ -1480,7 +1482,8 @@ model IitEquery {
|
||||
|
||||
/// 重大事件归档表 - SAE、重大方案偏离等长期临床资产
|
||||
model IitCriticalEvent {
|
||||
id String @id @default(uuid())
|
||||
// TODO: Tech Debt - DB 由 prisma db push 创建为 UUID 类型,未来大版本重构时统一为 String/TEXT
|
||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||
projectId String @map("project_id")
|
||||
recordId String @map("record_id")
|
||||
|
||||
@@ -1491,7 +1494,8 @@ model IitCriticalEvent {
|
||||
// 事件内容
|
||||
title String
|
||||
description String @db.Text
|
||||
detectedAt DateTime @map("detected_at")
|
||||
// TODO: Tech Debt - DB 由 prisma db push 创建为 TIMESTAMPTZ(6)
|
||||
detectedAt DateTime @map("detected_at") @db.Timestamptz(6)
|
||||
detectedBy String @default("ai") @map("detected_by")
|
||||
|
||||
// 来源追溯
|
||||
@@ -1502,15 +1506,15 @@ model IitCriticalEvent {
|
||||
// 处理状态
|
||||
status String @default("open")
|
||||
handledBy String? @map("handled_by")
|
||||
handledAt DateTime? @map("handled_at")
|
||||
handledAt DateTime? @map("handled_at") @db.Timestamptz(6)
|
||||
handlingNote String? @map("handling_note") @db.Text
|
||||
|
||||
// 上报追踪
|
||||
reportedToEc Boolean @default(false) @map("reported_to_ec")
|
||||
reportedAt DateTime? @map("reported_at")
|
||||
reportedAt DateTime? @map("reported_at") @db.Timestamptz(6)
|
||||
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||
|
||||
@@index([projectId], map: "idx_iit_critical_event_project")
|
||||
@@index([projectId, eventType], map: "idx_iit_critical_event_type")
|
||||
@@ -2513,17 +2517,18 @@ model SsaInterpretation {
|
||||
|
||||
/// SSA 多步骤流程
|
||||
model SsaWorkflow {
|
||||
id String @id @default(uuid())
|
||||
// TODO: Tech Debt - DB 由 prisma db push 创建,类型与 Prisma 默认不同,已手动对齐
|
||||
id String @id @default(dbgenerated("(gen_random_uuid())::text"))
|
||||
sessionId String @map("session_id")
|
||||
messageId String? @map("message_id") /// 关联的计划消息
|
||||
status String @default("pending") /// pending | running | completed | partial | error
|
||||
status String @default("pending") @db.VarChar(20) /// pending | running | completed | partial | error
|
||||
totalSteps Int @map("total_steps")
|
||||
completedSteps Int @default(0) @map("completed_steps")
|
||||
workflowPlan Json @map("workflow_plan") /// 原始计划 JSON
|
||||
reasoning String? @db.Text /// LLM 规划理由
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
startedAt DateTime? @map("started_at")
|
||||
completedAt DateTime? @map("completed_at")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
|
||||
startedAt DateTime? @map("started_at") @db.Timestamp(6)
|
||||
completedAt DateTime? @map("completed_at") @db.Timestamp(6)
|
||||
|
||||
session SsaSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
steps SsaWorkflowStep[]
|
||||
@@ -2536,19 +2541,20 @@ model SsaWorkflow {
|
||||
|
||||
/// SSA 流程步骤
|
||||
model SsaWorkflowStep {
|
||||
id String @id @default(uuid())
|
||||
// TODO: Tech Debt - DB 由 prisma db push 创建,类型与 Prisma 默认不同,已手动对齐
|
||||
id String @id @default(dbgenerated("(gen_random_uuid())::text"))
|
||||
workflowId String @map("workflow_id")
|
||||
stepOrder Int @map("step_order") /// 步骤顺序(1, 2, 3...)
|
||||
toolCode String @map("tool_code")
|
||||
toolName String @map("tool_name")
|
||||
status String @default("pending") /// pending | running | success | warning | error | skipped
|
||||
toolCode String @map("tool_code") @db.VarChar(50)
|
||||
toolName String @map("tool_name") @db.VarChar(100)
|
||||
status String @default("pending") @db.VarChar(20) /// pending | running | success | warning | error | skipped
|
||||
inputParams Json? @map("input_params") /// 输入参数
|
||||
guardrailChecks Json? @map("guardrail_checks") /// JIT 护栏检验结果
|
||||
outputResult Json? @map("output_result") /// 执行结果
|
||||
errorInfo Json? @map("error_info") /// 错误信息
|
||||
executionMs Int? @map("execution_ms") /// 执行耗时(毫秒)
|
||||
startedAt DateTime? @map("started_at")
|
||||
completedAt DateTime? @map("completed_at")
|
||||
startedAt DateTime? @map("started_at") @db.Timestamp(6)
|
||||
completedAt DateTime? @map("completed_at") @db.Timestamp(6)
|
||||
|
||||
workflow SsaWorkflow @relation(fields: [workflowId], references: [id], onDelete: Cascade)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user