Files
beads/internal/storage/sqlite
Steve Yegge f3a61a6458 Add auto-migration for dirty_issues table
Implement automatic database migration to add the dirty_issues table
for existing databases that were created before the incremental export
feature (bd-39) was implemented.

Changes:
- Add migrateDirtyIssuesTable() function in sqlite.go
- Check for dirty_issues table existence on database initialization
- Create table and index if missing (silent migration)
- Call migration after schema initialization in New()

The migration:
- Queries sqlite_master to check if dirty_issues table exists
- If missing, creates the table with proper schema and index
- Happens automatically on first database access after upgrade
- No user intervention required
- Fails safely if table already exists (no-op)

Testing:
- Created test database without dirty_issues table
- Verified table was auto-created on first command
- Verified issue was properly marked dirty
- All existing tests pass

This makes the incremental export feature (bd-39) work seamlessly
with existing databases without requiring manual migration steps.

Closes bd-51

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 00:19:10 -07:00
..