# 数据库切换与双数据库架构 > 所属模块:[架构概览](../概览.md) --- ## 文档索引 | 文档 | 说明 | |------|------| | [DbContext 工厂](./DbContext工厂.md) | 两个数据库上下文工厂设计 | | [迁移策略](./迁移策略.md) | 数据库迁移步骤 | --- ## 双数据库架构 ```text ┌─────────────────────────────────────────────────────────────────┐ │ appsettings.json │ │ Database:LocalPath → local.db │ │ Database:ReleasePath → release.db │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ DbContextFactory │ │ 读取配置 → 选择 Provider → 创建 WctMinerDbContext │ │ ReleaseDbContextFactory │ │ 读取配置 → 选择 Provider → 创建 ReleaseDbContext │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ local.db release.db │ │ ──────── ────────── │ │ tx_panel charging_parameter │ │ tx_hardware 独立实体,无外键关联 │ │ tx_software │ │ rx_type │ │ test_scenario │ │ qfod_record │ │ ploss_record │ └─────────────────────────────────────────────────────────────────┘ ``` ## 当前状态 | 项目 | 状态 | |------|------| | SQLite | ✅ 默认启用 | | PostgreSQL | ✅ 架构支持 | | local.db | ✅ 解析库 | | release.db | ✅ 发布库 | | 双库隔离 | ✅ 无外键/导航属性 |