Process: Ensure schema migrations run on deployment

t-152·Epic·
·
·
·Omni/Jr.hs
Created3 months ago·Updated3 months ago

Execution Summary

3/3
Tasks Completed
$0.00
Total Cost
0s
Total Time

Design

Edit

Problem Found

t-148.1, t-148.2, t-148.3 were marked Done but the feature wasn't working because: 1. Code was written and deployed 2. But task_activity table didn't exist in production DB 3. jr task init wasn't re-run after adding the new table 4. t-147 identified this issue but wasn't linked/prioritized

Root Cause

No automated schema migration on startup. User must manually run 'jr task init' after code updates that add tables.

Solution Options

Option A: Auto-migrate on startup (Recommended)

Call initTaskDb at web server and worker startup. It uses CREATE TABLE IF NOT EXISTS so it's idempotent.

Option B: Version-based migrations

Track schema version in DB, run migrations on startup. More complex but supports ALTER TABLE.

Option C: Startup check with error

Check for required tables on startup, fail with helpful message if missing.

Immediate Fix

  • Run 'jr task init' (done - table now exists)
  • Update t-147 to implement Option A

Process Improvements

1. Verification step in review: Before marking task Done, verify the feature actually works in production (not just that code compiles)

2. Link related tasks: t-147 identified the root cause but wasn't linked to t-148. Should have been a blocker.

3. Integration tests: Add test that spins up fresh DB and verifies web UI works end-to-end

Child Tasks

  • t-152.1 - Call initTaskDb on jr web startup [Done]
  • t-152.2 - Add verification checklist to task completion workflow [Done]
  • t-152.3 - Implement proper schema migrations for ALTER TABLE [Done]

Timeline (1)

🔄[human]Open → Done3 months ago