BE-PR-003: Add Essential SQLAlchemy model

- New app/models/essential.py with Essential model and EssentialType enum
  (feature, improvement, refactor)
- Fields: id, essential_code (unique), proposal_id (FK to proposes),
  type, title, description, created_by_id (FK to users), created_at, updated_at
- Added essentials relationship to Proposal model (cascade delete-orphan)
- Added essentials table auto-migration in main.py _migrate_schema()
- Registered essential module import in startup()
This commit is contained in:
zhi
2026-03-29 16:32:40 +00:00
parent 598900650d
commit 5ee79e5c5e

View File

@@ -40,11 +40,11 @@
- [x] 确认 Proposal 与 `project_id / created_by_id / feat_task_id` 的后续关系 - [x] 确认 Proposal 与 `project_id / created_by_id / feat_task_id` 的后续关系
- [x] 标记 `feat_task_id` 是否废弃或替换 - [x] 标记 `feat_task_id` 是否废弃或替换
- [ ] BE-PR-003:新增 Essential 模型(backend only) - [x] BE-PR-003:新增 Essential 模型(backend only)
- [ ] 新增 `Essential` SQLAlchemy model - [x] 新增 `Essential` SQLAlchemy model
- [ ] 增加 `proposal_id` 外键 - [x] 增加 `proposal_id` 外键
- [ ] 增加 `essential_code` - [x] 增加 `essential_code`
- [ ] 增加 `type / title / description / created_by_id / created_at / updated_at` - [x] 增加 `type / title / description / created_by_id / created_at / updated_at`
- [ ] BE-PR-004:实现 EssentialCode 编码规则(backend only) - [ ] BE-PR-004:实现 EssentialCode 编码规则(backend only)
- [ ] 参考现有 `ProjectCode / MilestoneCode / TaskCode / ProposeCode` 生成方式 - [ ] 参考现有 `ProjectCode / MilestoneCode / TaskCode / ProposeCode` 生成方式