Files
WCTDataMiner/docs/architecture/database/概览.md

45 lines
2.1 KiB
Markdown
Raw Normal View History

# 数据库切换支持
> 所属模块:[架构概览](../概览.md)
---
## 文档索引
| 文档 | 说明 |
|------|------|
| [DbContext 工厂](./DbContext工厂.md) | 数据库上下文工厂设计 |
| [迁移策略](./迁移策略.md) | 数据库迁移和切换步骤 |
---
## 切换策略概览
```
┌─────────────────────────────────────────────────────────────┐
│ appsettings.json │
│ "Database": { "Type": "sqlite" | "postgresql" } │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ DbContextFactory │
│ 读取配置 → 选择 Provider → 创建 DbContext │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ WctMinerDbContext │
│ 统一的 DbModel 配置,适配两种数据库 │
└─────────────────────────────────────────────────────────────┘
```
---
## 当前状态
| 项目 | 状态 |
|------|------|
| SQLite | ✅ 默认启用 |
| PostgreSQL | ✅ 架构支持,待配置 |
| 切换方式 | 配置文件切换 |