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:
13
infra/migrations/0020_add_format_to_books.sql
Normal file
13
infra/migrations/0020_add_format_to_books.sql
Normal 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;
|
||||
Reference in New Issue
Block a user