parent
f8d5ecde0a
commit
e78b4517ec
@ -0,0 +1,24 @@
|
||||
workflow: full
|
||||
phase: design
|
||||
context_compression: off
|
||||
build_mode: null
|
||||
build_pause: null
|
||||
subagent_dispatch: null
|
||||
tdd_mode: null
|
||||
review_mode: thorough
|
||||
isolation: null
|
||||
verify_mode: full
|
||||
auto_transition: true
|
||||
base_ref: f8d5ecd
|
||||
design_doc: null
|
||||
plan: null
|
||||
verify_result: null
|
||||
verification_report: null
|
||||
branch_status: null
|
||||
created_at: 2026-07-04
|
||||
verified_at: null
|
||||
archived: false
|
||||
handoff_context: null
|
||||
handoff_hash: null
|
||||
build_command: python -m pytest tests/ -v
|
||||
verify_command: python -m pytest tests/ -v
|
||||
@ -0,0 +1,3 @@
|
||||
name: config-to-mysql
|
||||
created: 2026-07-04
|
||||
status: active
|
||||
@ -0,0 +1,37 @@
|
||||
# Tasks: Config to MySQL
|
||||
|
||||
## 1. 数据模型与配置存储模块
|
||||
|
||||
- [ ] 1.1 在 `app/models.py` 中新增 `AppConfig` 模型
|
||||
- [ ] 1.2 创建 `app/config_store.py`,实现 `ConfigStore` 类
|
||||
- [ ] 1.3 实现 `get_config(key)` 方法,支持 MySQL → JSON 降级
|
||||
- [ ] 1.4 实现 `set_config(key, value)` 方法,支持 MySQL + JSON 双写
|
||||
- [ ] 1.5 实现 `load_from_json(key, fallback)` 辅助方法
|
||||
|
||||
## 2. 数据迁移
|
||||
|
||||
- [ ] 2.1 创建 `app/config_migration.py`,实现 `migrate_configs_to_mysql()`
|
||||
- [ ] 2.2 在 `app/main.py` lifespan 中创建 `app_config` 表
|
||||
- [ ] 2.3 在 `app/main.py` lifespan 中调用迁移函数
|
||||
- [ ] 2.4 迁移幂等性:数据库已有配置时跳过
|
||||
|
||||
## 3. 修改配置 API
|
||||
|
||||
- [ ] 3.1 修改 `app/api/config.py` 使用 `ConfigStore` 读写 `symbols` 配置
|
||||
- [ ] 3.2 修改 `app/api/ai_config.py` 使用 `ConfigStore` 读写 `ai` 配置
|
||||
- [ ] 3.3 保持 API 接口签名不变
|
||||
|
||||
## 4. 修改业务使用方
|
||||
|
||||
- [ ] 4.1 修改 `app/api/futures_analysis.py` 从 `ConfigStore` 读取品种配置
|
||||
- [ ] 4.2 修改 `app/api/trade_review.py` 从 `ConfigStore` 读取品种配置
|
||||
- [ ] 4.3 修改 `app/services/trade_parser.py` 从 `ConfigStore` 读取品种配置
|
||||
- [ ] 4.4 修改 `app/services/plan_generator.py` 从 `ConfigStore` 读取品种配置
|
||||
- [ ] 4.5 修改 `app/services/ai_analysis.py` 从 `ConfigStore` 读取 AI 配置
|
||||
|
||||
## 5. 测试与验证
|
||||
|
||||
- [ ] 5.1 编写 `tests/test_config_store.py`,覆盖 MySQL 命中/未命中/降级场景
|
||||
- [ ] 5.2 编写迁移测试,验证幂等性
|
||||
- [ ] 5.3 运行全部测试套件,确保无回归
|
||||
- [ ] 5.4 启动应用验证配置读取正常
|
||||
Loading…
Reference in new issue