Files
ColaFlow/docs/plans/sprint_4_story_0_task_4.md
Yaojia Wang b3c92042ed 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>
2025-11-05 21:45:09 +01:00

2.9 KiB

task_id, story_id, sprint_id, status, type, assignee, created_date, completion_date
task_id story_id sprint_id status type assignee created_date completion_date
task_4 story_0 sprint_4 not_started backend backend 2025-11-05 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:

cd colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Infrastructure
dotnet ef migrations add AddAdvancedStoryTaskFields --context ProjectManagementDbContext

Expected Migration Content

Up Migration:

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:

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:

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:

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