Skip to main content

## MIGRATION_019

# Constant MIGRATION_019

Source

    const MIGRATION_019: &str = r#"
    CREATE TABLE IF NOT EXISTS genres (
        id TEXT NOT NULL,
        server_id TEXT NOT NULL,
        library_id TEXT,
        name TEXT NOT NULL,
        album_count INTEGER,
        synced_at TEXT DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (server_id, library_id, name)
    );

    CREATE INDEX IF NOT EXISTS idx_genres_scope ON genres(server_id, library_id);
    "#;

Expand description

Migration to cache the full server genre catalog. Previously genres were derived on the fly from cached albums, which meant offline (and the hybrid cache-first race) only ever saw genres for the handful of locally-cached albums — collapsing the variety on the music/TV/movie landing pages. This table stores the complete genre list per library so offline has the real catalog and cache-first routing returns the right thing.