# Task T01-001: 数据库 Schema 验证 ## 元信息 | 字段 | 值 | |------|-----| | 状态 | `todo` | | 优先级 | P0 | | 对应 Coder task | P01-001 | | 分配给 | Tester AI (Coze CN) | ## 测试目标 验证 Drizzle 迁移脚本是否正确创建了所有表、字段类型、索引、外键。 ## 被测对象 **Coder 产出的 commit**: - 从 git log 查找 commit message 包含 `[READY_FOR_TEST]` 且 task 编号为 `P01-001` 的最新 commit **Coder task 文件**: - [P01-001](P01-001.md) — 理解该 task 的输出和约束 ## 测试内容 **关键路径**: - [ ] 所有 10 张表已创建(users, user_relations, error_items, error_item_images, correction_logs, knowledge_points, question_knowledge_map, questions, print_tasks, recommendation_logs) - [ ] users 表 role 字段为 VARCHAR,invitation_code 字段存在 - [ ] knowledge_points 表 code 字段存在(VARCHAR) - [ ] questions 表 question_type(6 种)、difficulty(SMALLINT 1-5)、source 字段存在 - [ ] error_items 表 verification_status 字段 + ai_confidence JSONB 字段存在 - [ ] correction_logs 表 ai_value + user_value JSONB 字段存在 - [ ] print_tasks 表 status + file_url + expires_at 字段存在 - [ ] user_relations 表支持递归 CTE(parent_user_id + child_user_id + level) - [ ] 所有索引已创建(按数据模型文档核对) **不应发生的**: - [ ] 无 missing table - [ ] 无字段类型错误(如 JSONB 写成 TEXT) - [ ] 无 missing index ## 执行方式 ``` 1. git pull → 拉取最新代码 2. 在 Coze 沙盒中执行迁移 3. 查询 information_schema 对比数据模型文档 4. 生成测试报告 ``` ## 报告格式 输出 `reports/T01-001-{日期}.json` ## 完成报告 > Tester 完成后填写。 - [ ] 测试已执行 - [ ] 报告已生成 → `reports/T01-001-{日期}.json` - [ ] Commit: `{hash}` - [ ] Commit message: `test(T01-001): {结论}` - [ ] 结论: PASS / FAIL / RETRY