?
TRCKR-108
phase-1
Created: 2025-12-08 Updated: 2025-12-16
Relationships Loading...
Attachments
Loading...
Comments (1)
agent · 2025-12-08
Implemented JSON to SQLite migration tool as specified in migration.md. ## What was implemented Created two main components: 1. **client/migration.py** (687 lines) - Pre-migration checks: validates JSON file, checks disk space, verifies write permissions - Entity migration in dependency order: projects → milestones → issues → comments → documents → attachments → relationships - Counter migration: global issue counter + per-project counters - Post-migration verification: count verification + random sample checks - Automatic backup: creates .json.backup with timestamp if multiple backups exist - Atomic operation: rolls back database on failure - Edge case handling: - Legacy field names (worklogs → comments, message → body, agent_name → author) - Invalid status values (normalized to valid defaults) - Missing optional fields (use defaults) - Duplicate relationships (skipped via UNIQUE constraint) 2. **trckr.py** (43 new lines) - Added 'trckr migrate' command with flags: - --dry-run: Shows what would be migrated without making changes - --force: Allows overwriting existing database - --from: Custom JSON source path - --to: Custom database destination path - --json: Machine-readable JSON output - Defaults to current store path if not specified - Graceful error handling with JSON output option ## Testing All 919 existing tests pass without modification. Manual testing confirmed: - Successful migration of issues, projects, milestones - Proper backup file creation (trckr.json.backup) - Status normalization (e.g., invalid project status 'triage' → 'active') - Dry-run mode works correctly - Force flag allows re-migration - JSON output mode produces valid JSON ## Files changed - /tmp/trckr-BT-3/client/migration.py (new file, 687 lines) - /tmp/trckr-BT-3/trckr.py (+43 lines, added migrate command) Committed as 5d5c33c and merged to master.