Context
Application currently has no cycle tracking. All applications, nominations, endorsements, and settings exist in single timeframe.
Goal
Create Cycle model and add cycleId to applications, nominations, endorsements, settings. Migrate existing data to default active cycle.
Schema Changes
- Create Cycle model: id, name, isActive (Boolean), createdAt, updatedAt, deletedAt
- Add cycleId (required FK) to Application, Nomination, Endorsement
- Add cycleId (required FK, unique) to Settings
- Add relations on all models
Migration Steps
- Create Cycle model
- Create default cycle:
{ name: "Current Cycle", isActive: true }
- Add cycleId fields to existing models
- Migrate all existing applications to default cycle
- Migrate all existing nominations to default cycle
- Migrate all existing endorsements to default cycle
- Migrate existing settings record to default cycle (link via cycleId)
Acceptance Criteria
- Cycle model created with isActive field
- All applications have cycleId
- All nominations have cycleId
- All endorsements have cycleId
- Settings has cycleId with unique constraint
- Existing data migrated to default active cycle
- CommunityConstituency unchanged
Context
Application currently has no cycle tracking. All applications, nominations, endorsements, and settings exist in single timeframe.
Goal
Create Cycle model and add cycleId to applications, nominations, endorsements, settings. Migrate existing data to default active cycle.
Schema Changes
Migration Steps
{ name: "Current Cycle", isActive: true }Acceptance Criteria