Files
WCTDataMiner/docs/architecture/database/概览.md
ssss 28cb2533a7 docs: 完善数据模型设计
- 重命名 log_file 为 test_scenario(测试场景)
- 拆分维度表:tx_panel、tx_hardware、tx_software、rx_type
- 采用星型模型设计,消除数据冗余
- 为所有表添加软删除字段 is_deleted
- 更新关系说明,包含全局查询过滤器配置
- 更新 ER 图和查询示例

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 15:53:30 +08:00

2.1 KiB

数据库切换支持

所属模块:架构概览


文档索引

文档 说明
DbContext 工厂 数据库上下文工厂设计
迁移策略 数据库迁移和切换步骤

切换策略概览

┌─────────────────────────────────────────────────────────────┐
│                    appsettings.json                         │
│  "Database": { "Type": "sqlite" | "postgresql" }            │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    DbContextFactory                         │
│  读取配置 → 选择 Provider → 创建 DbContext                   │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    WctMinerDbContext                        │
│  统一的 DbModel 配置,适配两种数据库                         │
└─────────────────────────────────────────────────────────────┘

当前状态

项目 状态
SQLite 默认启用
PostgreSQL 架构支持,待配置
切换方式 配置文件切换