文档: todo销账(batch29 ARC-05/06+FR-D3+R-PD-10)+待审查登记+DOC整理

- todo: ARC-05越层核验0命中+四领域拆分/ARC-06破环aiShared/FR-D3三子项闭环销账+新增ARC-06b遗留

- 待审查: 登记CR-260616-02(batch29+R-PD-10代码 fc767e1)待审

- DOC-14: df-storage/SQLite-CRUD文档表数V13/V9→V15对齐migrations.rs schema_version=15
This commit is contained in:
2026-06-16 03:28:20 +08:00
parent fc767e1db6
commit 212a927eee
4 changed files with 55 additions and 30 deletions

View File

@@ -6,7 +6,7 @@
## 概述
df-storage 是 DevFlow 的数据持久化层,基于 SQLite (rusqlite)负责连接管理、Schema 迁移V1-V13)和 CRUD 操作。绝大多数 Repo 由 `impl_repo!` 宏自动生成KV 类表(`app_settings`)手写 Repo。
df-storage 是 DevFlow 的数据持久化层,基于 SQLite (rusqlite)负责连接管理、Schema 迁移V1-V15)和 CRUD 操作。绝大多数 Repo 由 `impl_repo!` 宏自动生成KV 类表(`app_settings`)手写 Repo。
---
@@ -15,8 +15,8 @@ df-storage 是 DevFlow 的数据持久化层,基于 SQLite (rusqlite),负责
| 功能 | 状态 |
|------|------|
| SQLite 连接管理 | ✅ |
| Schema 迁移 V1-V13 | ✅ |
| impl_repo! 宏 CRUD12 Repo | ✅ |
| Schema 迁移 V1-V15 | ✅ |
| impl_repo! 宏 CRUD17 Repo | ✅ |
| KV 类手写 RepoSettingsRepo | ✅ |
| KnowledgeRepo含向量| ✅ Sprint 15 |
| KnowledgeEventsRepo生命线审计| ✅ |
@@ -24,7 +24,7 @@ df-storage 是 DevFlow 的数据持久化层,基于 SQLite (rusqlite),负责
---
## 数据表V1-V13 迁移历史)
## 数据表V1-V15 迁移历史)
| 版本 | 新增/变更 |
|------|-----------|
@@ -41,6 +41,8 @@ df-storage 是 DevFlow 的数据持久化层,基于 SQLite (rusqlite),负责
| V11 | 幂等补列projects.deleted_at软删回收站|
| V12 | 幂等补列projects.path / projects.stack项目绑定真实代码目录 + 技术栈)|
| V13 | 新建 **app_settings** 表(通用应用设置 KV前端 localStorage 迁移目标)|
| V14 | 幂等补列tasks.deleted_at软删回收站对标 projects.deleted_at V11D-260616-02 决策)|
| V15 | 幂等补列tasks.review_rounds INTEGER NOT NULL DEFAULT 0review 退回累计轮数F-260616-04 任务推进链)|
> **当前共 13 张业务表**ideas / projects / tasks / releases / workflow_executions / node_executions / branches / ai_conversations / ai_providers / ai_tool_executions / knowledges / knowledge_events / app_settings。另有一张内部表 `schema_version`(仅记录版本号,无业务语义)。
@@ -125,7 +127,7 @@ fn cosine_similarity(a: &[f32], b: &[f32]) -> f32 // 点积 / (‖a‖‖b‖
## 迁移幂等设计
迁移机制:`schema_version` 表记录已应用版本,`run()` 读出 `MAX(version)``current_version`,按 `current_version < N` 顺序应用 V1…V13(每版应用后 `INSERT` 对应版本号)。当前最新目标版本为 **13**
迁移机制:`schema_version` 表记录已应用版本,`run()` 读出 `MAX(version)``current_version`,按 `current_version < N` 顺序应用 V1…V15(每版应用后 `INSERT` 对应版本号)。当前最新目标版本为 **15**
> 注:早期版本曾用 `MIGRATION_VERSION` 常量,现已无此常量——版本号直接散落在各 `if current_version < N` 分支,由 `schema_version` 表动态跟踪。
@@ -134,7 +136,7 @@ fn cosine_similarity(a: &[f32], b: &[f32]) -> f32 // 点积 / (‖a‖‖b‖
关键列补建不依赖版本号,用 `PRAGMA table_info(<table>)` 探测实际 schema缺列才 `ALTER TABLE ADD COLUMN`
- 对新库列已由建表带入、老库DDL 正常生效)、坏库(版本号已写入但 DDL 漏生效)三种情况都安全幂等。
- V4/V5/V6/V8/V10/V11/V12 均复用此模式(补列迁移)。
- V4/V5/V6/V8/V10/V11/V12/V14/V15 均复用此模式(补列迁移)。
- V9/V10/V13 用 `CREATE TABLE IF NOT EXISTS` 幂等建表(老库已有表则跳过)。
---
@@ -145,7 +147,7 @@ fn cosine_similarity(a: &[f32], b: &[f32]) -> f32 // 点积 / (‖a‖‖b‖
crates/df-storage/src/
├── lib.rs — 模块入口,导出公共 API
├── db.rs — SQLite 连接管理Database struct
├── migrations.rs — V1-V13 迁移逻辑schema_version 表跟踪版本)
├── migrations.rs — V1-V15 迁移逻辑schema_version 表跟踪版本)
├── models.rs — 全部 *Record struct含 KnowledgeRecord / KnowledgeEventRecord
└── crud.rs — impl_repo! 宏 + 全部 Repo含 KnowledgeRepo / KnowledgeEventsRepo / SettingsRepo
```