feat(books): ajouter le champ format en base et l'exposer dans l'API

- Migration 0020 : colonne format sur books, backfill depuis book_files
- batch.rs / scanner.rs : l'indexer écrit le format dans books
- books.rs : format dans BookItem + filtre ?format= dans list_books
- perf_pages.sh : benchmarks par format CBZ/CBR/PDF

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 08:55:18 +01:00
parent 85e0945c9d
commit 5db2a7501b
5 changed files with 236 additions and 13 deletions

View File

@@ -0,0 +1,13 @@
-- Add format column to books table (denormalized from book_files for easy API access)
ALTER TABLE books ADD COLUMN IF NOT EXISTS format TEXT CHECK (format IN ('pdf', 'cbz', 'cbr'));
-- Backfill from book_files (take the format of the most recent file per book)
UPDATE books b
SET format = bf.format
FROM (
SELECT DISTINCT ON (book_id) book_id, format
FROM book_files
ORDER BY book_id, updated_at DESC
) bf
WHERE b.id = bf.book_id
AND b.format IS NULL;