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
3.5 KiB
3.5 KiB
环境状态对照表
版本: v1.0
更新日期: 2026-02-27
维护说明: 每次部署后更新此表,确保三环境状态可追溯
1. 环境概览
| 环境 | 数据库类型 | 地址 | 数据库名 | 用户 |
|---|---|---|---|---|
| 本地开发 | Docker (pgvector/pgvector:pg15) | localhost:5432 | ai_clinical_research | postgres |
| 测试环境 | 阿里云 RDS PostgreSQL 15 | pgm-2zex1m2y3r23hdn5so.pg.rds.aliyuncs.com:5432 | ai_clinical_research_test | airesearch |
| 生产环境 | 待部署 | — | — | — |
2. 迁移状态对比
截止日期:2026-02-27
| # | 迁移名 | 本地开发 | 测试 RDS | 说明 |
|---|---|---|---|---|
| 1 | 20251010075003_init | ✅ | ✅ | |
| 2 | 20251010122727_add_conversation_metadata_deleted_at | ✅ | ✅ | |
| 3 | 20251012124747_add_batch_processing_module | ✅ | ✅ | |
| 4 | 20251014120128_add_review_tasks | ✅ | ✅ | |
| 5 | 20251208_add_column_mapping | ✅ | ✅ | |
| 6 | 20260128_add_system_knowledge_base | ✅ | ✅ | |
| 7 | 20260207112544_add_iit_manager_agent_tables | ✅ | ✅ | 0227 部署时应用 |
| 8 | 20260208134925_add_cra_qc_engine_support | ✅ | ✅ | 0227 部署时应用 |
| 9 | 20260219_add_ssa_module | ✅ | ✅ | 0227 部署时应用 |
| 10 | 20260223_add_deep_research_v2_fields | ✅ | ✅ | 0227 部署时应用 |
| 11 | 20260225_add_extraction_template_engine | ✅ | ✅ | 0227 部署时应用 |
| 12 | 20260227_patch_db_push_drift | ✅ | ✅ | 0227 部署时应用 |
| 13 | 20260226_add_equery_critical_events_cron | ✅ | ✅ | 0227 部署时应用 |
| 14 | 20260227_align_schema_with_db_types | ✅ | ❌ | 本地对齐,尚未部署到 RDS |
3. PostgreSQL 扩展对比
| 扩展 | 本地开发 | 测试 RDS | 说明 |
|---|---|---|---|
| plpgsql | 1.0 | 1.0 | PostgreSQL 内置 |
| pgvector (vector) | 0.8.1 | 0.8.0 | 向量搜索,RDS 版本略低 |
| pg_bigm | 1.2 | 1.2 | 中文全文检索 |
4. Schema 结构对比
| Schema | 本地开发 表数 | 测试 RDS 表数 | 差异说明 |
|---|---|---|---|
| platform_schema | 19 | 19 | 一致 |
| capability_schema | 4 | 4 | 一致 |
| agent_schema | 6 | 6 | 一致 |
| ekb_schema | 3 | 3 | 一致 |
| admin_schema | 2 | 2 | 一致 |
| iit_schema | 20 | 20 | 一致(0227 部署后) |
| ssa_schema | 11 | 11 | RDS 缺少 #14 的类型对齐 |
| asl_schema | 11 | 11 | 一致 |
| rvw_schema | 1 | 1 | 一致(0227 补 8 列后) |
| dc_schema | 6 | 6 | 一致 |
| aia_schema | 3 | 3 | 一致 |
| protocol_schema | 2 | 2 | 一致 |
| pkb_schema | 5 | 5 | 一致 |
| public | 3 | 3 | 一致 |
5. 已知的环境差异
5.1 测试 RDS 待部署项
| 项目 | 内容 | 优先级 | 风险 |
|---|---|---|---|
| 迁移 #14 | ssa_workflows 类型精度对齐 + 重复 FK 清理 | 低 | 无数据影响,幂等 SQL |
5.2 本地开发特有
| 项目 | 说明 |
|---|---|
prisma db push 产生的额外结构 |
部分表/列未通过迁移创建,已由 #12 drift patch 覆盖 |
| Shadow DB 重放失败 | #10 迁移依赖 research_tasks(非迁移创建),影响 prisma migrate dev |
6. 更新日志
| 日期 | 操作人 | 变更 |
|---|---|---|
| 2026-02-27 | AI 助手 | 初始化文档,记录 0227 部署后状态 |
7. 维护规则
- 每次部署后:更新第 2 节迁移状态和第 4 节表数
- 新增扩展后:更新第 3 节扩展对比
- 发现差异时:记录在第 5 节,标注优先级和风险