diff --git a/database/schema/schema.sql b/database/schema/schema.sql index 38d4c6d3..9370a117 100644 --- a/database/schema/schema.sql +++ b/database/schema/schema.sql @@ -174,7 +174,7 @@ CREATE TABLE IF NOT EXISTS media_items ( language VARCHAR(10) DEFAULT 'en', -- Language code (ISO 639-1) edition VARCHAR(100), -- Edition information page_count INTEGER, -- Total page count - genre VARCHAR(100), -- Genre classification + genre TEXT, -- Genre classification (smart-genre shelf OR raw tag free text — Audible category strings exceed 100 chars) copyright_year INTEGER, -- Copyright/publication year goodreads_id VARCHAR(50), -- Goodreads identifier openlibrary_id VARCHAR(50), -- Open Library identifier @@ -279,6 +279,14 @@ CREATE INDEX IF NOT EXISTS idx_media_items_contributors_gin ON media_items USING ALTER TABLE media_items ADD COLUMN IF NOT EXISTS tags_search TEXT[]; ALTER TABLE media_items ADD COLUMN IF NOT EXISTS contributors_search TEXT[]; +-- Widen genre for existing databases: the audio tag fallback stores the +-- raw file genre atom (Audible category strings exceed 100 chars — +-- e.g. "Politicians, Presidents & Heads of State, United States, ..."), +-- and VARCHAR(100) rejected the whole import/update at the database +-- layer (SQLSTATE 22001). VARCHAR -> TEXT is a metadata-only change, +-- safe to re-run (media_highlights position widening precedent). +ALTER TABLE media_items ALTER COLUMN genre TYPE TEXT; + -- Audiobook editorial facts (A2a): narrators are user-editable first-class -- (search/filter/badge surface); abridged rides along; audio_metadata keeps -- the scan-derived tech record (duration/codec/chapters).