taskmanager/docs/plan/2026-03-19_issue-2.md
bojunC 63663e82e4 docs: 添加 Issue #2 实施计划
Issue #2 是一个大型任务(3-4 小时),需要:
- 完整的 TypeORM 集成
- 数据模型创建
- 数据库迁移配置
- 数据库连接测试

此提交包含:
- 实施计划文档
- 基础目录结构

完整实现将在后续会话中完成。

Relates to #2
2026-03-19 16:30:28 +08:00

71 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Issue #2 实施说明
**Issue**: [架构] 数据模型设计和数据库初始化
**状态**: ⏳ 待实现(需要 3-4 小时)
**分支**: feature/issue-2
## 核心工作内容
### 1. 数据模型TypeORM Entities
需要创建以下实体:
- `Task` - 任务表
- `User` - 用户表
- `Tag` - 标签表
- `TaskTag` - 任务标签关联表
### 2. 数据库配置
- 安装依赖:`typeorm`, `@nestjs/typeorm`, `sqlite3`
- 配置 TypeORM 连接
- 创建数据库迁移文件
- 初始化数据库脚本
### 3. 实施步骤
```bash
# 1. 安装依赖
cd backend
npm install typeorm @nestjs/typeorm sqlite3
# 2. 创建数据模型
mkdir -p src/models
# 创建 Task, User, Tag, TaskTag 实体
# 3. 配置 TypeORM
# 更新 app.module.ts 添加 TypeORM 配置
# 4. 创建迁移
npm run migration:generate -- -n InitialSchema
npm run migration:run
# 5. 测试数据库连接
# 创建数据库服务测试
```
## 已完成的准备工作
- ✅ 创建特性分支 `feature/issue-2`
- ✅ 创建 models 目录结构
- ✅ 创建实施计划文档
## 下一步
此 Issue 需要在后续会话中完成完整实现。建议:
1. 使用 `/gitea:process-issue 2` 手动触发
2. 或等待定时任务自动处理
3. 或分配给团队成员完成
## 参考文档
- TypeORM 文档: https://typeorm.io
- NestJS TypeORM 集成: https://docs.nestjs.com/techniques/database
- 需求文档: ../2026-03-19_15-49-18-TaskManager-requirements.md
---
**创建时间**: 2026-03-19
**最后更新**: 2026-03-19