docs(backend): Add Sprint 4 backend API verification and optional enhancement story
Backend APIs are 100% ready for Sprint 4 frontend implementation. Created comprehensive verification report and optional enhancement story for advanced UX fields. Changes: - Created backend_api_verification.md (detailed API analysis) - Created Story 0: Backend API Enhancements (optional P2) - Created 6 tasks for Story 0 implementation - Updated Sprint 4 to include backend verification status - Verified Story/Task CRUD APIs are complete - Documented missing optional fields (AcceptanceCriteria, Tags, StoryPoints, Order) - Provided workarounds for Sprint 4 MVP Backend Status: - Story API: 100% complete (8 endpoints) - Task API: 100% complete (9 endpoints) - Security: Multi-tenant isolation verified - Missing optional fields: Can be deferred to future sprint Frontend can proceed with P0/P1 Stories without blockers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
114
docs/plans/sprint_4_story_0_task_4.md
Normal file
114
docs/plans/sprint_4_story_0_task_4.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
task_id: task_4
|
||||
story_id: story_0
|
||||
sprint_id: sprint_4
|
||||
status: not_started
|
||||
type: backend
|
||||
assignee: backend
|
||||
created_date: 2025-11-05
|
||||
completion_date: null
|
||||
---
|
||||
|
||||
# Task 4: Create and Apply Database Migration
|
||||
|
||||
## What to do
|
||||
|
||||
Create an EF Core migration to add the new fields (AcceptanceCriteria, Tags, StoryPoints on Story; Order on Task) to the database.
|
||||
|
||||
## Files to create
|
||||
|
||||
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Infrastructure/Migrations/YYYYMMDDHHMMSS_AddAdvancedStoryTaskFields.cs`
|
||||
|
||||
## Implementation
|
||||
|
||||
### Migration Creation
|
||||
|
||||
Run EF Core migration command:
|
||||
```bash
|
||||
cd colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Infrastructure
|
||||
dotnet ef migrations add AddAdvancedStoryTaskFields --context ProjectManagementDbContext
|
||||
```
|
||||
|
||||
### Expected Migration Content
|
||||
|
||||
**Up Migration**:
|
||||
```csharp
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AcceptanceCriteria",
|
||||
table: "Stories",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Tags",
|
||||
table: "Stories",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "StoryPoints",
|
||||
table: "Stories",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Order",
|
||||
table: "Tasks",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Tasks_StoryId_Order",
|
||||
table: "Tasks",
|
||||
columns: new[] { "StoryId", "Order" });
|
||||
```
|
||||
|
||||
**Down Migration**:
|
||||
```csharp
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Tasks_StoryId_Order",
|
||||
table: "Tasks");
|
||||
|
||||
migrationBuilder.DropColumn(name: "AcceptanceCriteria", table: "Stories");
|
||||
migrationBuilder.DropColumn(name: "Tags", table: "Stories");
|
||||
migrationBuilder.DropColumn(name: "StoryPoints", table: "Stories");
|
||||
migrationBuilder.DropColumn(name: "Order", table: "Tasks");
|
||||
```
|
||||
|
||||
### Data Backfill (Optional)
|
||||
|
||||
Add SQL to set Task Order based on CreatedAt:
|
||||
```csharp
|
||||
migrationBuilder.Sql(@"
|
||||
WITH OrderedTasks AS (
|
||||
SELECT Id, ROW_NUMBER() OVER (PARTITION BY StoryId ORDER BY CreatedAt) - 1 AS NewOrder
|
||||
FROM Tasks
|
||||
)
|
||||
UPDATE t
|
||||
SET t.[Order] = ot.NewOrder
|
||||
FROM Tasks t
|
||||
INNER JOIN OrderedTasks ot ON t.Id = ot.Id;
|
||||
");
|
||||
```
|
||||
|
||||
### Apply Migration
|
||||
|
||||
Run migration locally:
|
||||
```bash
|
||||
cd colaflow-api/src/ColaFlow.API
|
||||
dotnet ef database update --context ProjectManagementDbContext
|
||||
```
|
||||
|
||||
## Acceptance
|
||||
|
||||
- [ ] Migration file created
|
||||
- [ ] Migration adds AcceptanceCriteria column (nvarchar(max), nullable)
|
||||
- [ ] Migration adds Tags column (nvarchar(max), nullable)
|
||||
- [ ] Migration adds StoryPoints column (int, nullable)
|
||||
- [ ] Migration adds Order column (int, not null, default 0)
|
||||
- [ ] Migration creates composite index (StoryId, Order)
|
||||
- [ ] Migration applied successfully to local database
|
||||
- [ ] Schema verified in database
|
||||
- [ ] Rollback migration tested
|
||||
- [ ] Migration script committed
|
||||
Reference in New Issue
Block a user