Context
Part of the Book Sources Refactor (Phase R1 completed in branch 003-non-calibre-books). This is a follow-up phase to complete the architectural transition from the single calibre_id field to the many-to-many book_sources table.
Dependencies
Blocked by: #185 (Support non-Calibre books)
- Must wait until Phase R1 (Book Sources Refactor) is released and stable in production
- This ensures we have sufficient production data to validate the transition works correctly
Goal
Remove the deprecated books.calibre_id column and fully transition all code to use bookSourceRepository for querying book sources.
Current State
After Phase R1:
books.calibre_id marked as deprecated with comment
- All new code uses
book_sources table via bookSourceRepository
- Legacy code still references
calibre_id in some places (primarily for Calibre-specific operations)
- Migration 0022 populates both
calibre_id and book_sources for backward compatibility
Scope
1. Code Audit
2. Code Updates
3. Schema Changes
4. Testing
5. Documentation
Risk Assessment
Medium Risk:
- Removing a core identifier field requires careful testing
- Any missed
calibre_id references will cause runtime errors
- Migration is not easily reversible
Mitigation:
- Comprehensive code audit before starting
- Staged rollout: Test on staging environment first
- Keep backups before migration
- Monitor for errors after deployment
Timeline
Estimated: 8-12 hours
- Code audit: 2 hours
- Code updates: 4 hours
- Migration: 1 hour
- Testing: 3 hours
- Documentation: 2 hours
Success Criteria
Context
Part of the Book Sources Refactor (Phase R1 completed in branch
003-non-calibre-books). This is a follow-up phase to complete the architectural transition from the singlecalibre_idfield to the many-to-manybook_sourcestable.Dependencies
Blocked by: #185 (Support non-Calibre books)
Goal
Remove the deprecated
books.calibre_idcolumn and fully transition all code to usebookSourceRepositoryfor querying book sources.Current State
After Phase R1:
books.calibre_idmarked as deprecated with commentbook_sourcestable viabookSourceRepositorycalibre_idin some places (primarily for Calibre-specific operations)calibre_idandbook_sourcesfor backward compatibilityScope
1. Code Audit
books.calibre_id2. Code Updates
bookRepository.findByCalibreId()withbookSourceRepository.findByExternalId("calibre", id)calibre_id3. Schema Changes
books.calibre_idcolumnbook_sources.external_id(previously nullable)4. Testing
calibre_id5. Documentation
Risk Assessment
Medium Risk:
calibre_idreferences will cause runtime errorsMitigation:
Timeline
Estimated: 8-12 hours
Success Criteria
books.calibre_idin codebase (except migration files)bookSourceRepositoryfor source lookups