Skip to main content

## MIGRATION_008

# Constant MIGRATION_008

Source

    const MIGRATION_008: &str = r#"
    -- Add video-specific metadata columns to downloads
    ALTER TABLE downloads ADD COLUMN series_name TEXT;
    ALTER TABLE downloads ADD COLUMN season_name TEXT;
    ALTER TABLE downloads ADD COLUMN episode_number INTEGER;
    ALTER TABLE downloads ADD COLUMN season_number INTEGER;
    ALTER TABLE downloads ADD COLUMN quality_preset TEXT DEFAULT 'original';
    ALTER TABLE downloads ADD COLUMN media_type TEXT DEFAULT 'audio';

    -- Add pinning support to items table
    -- Pinned items are protected from cache clear operations
    ALTER TABLE items ADD COLUMN is_pinned INTEGER DEFAULT 0;

    -- Index for efficiently finding pinned items
    CREATE INDEX IF NOT EXISTS idx_items_pinned ON items(is_pinned) WHERE is_pinned = 1;

    -- Index for efficiently querying downloads by series
    CREATE INDEX IF NOT EXISTS idx_downloads_series ON downloads(series_name) WHERE series_name IS NOT NULL;

    -- Index for filtering by media type
    CREATE INDEX IF NOT EXISTS idx_downloads_media_type ON downloads(media_type);
    "#;

Expand description

Migration to add video download support and item pinning

- Adds video-specific metadata columns to downloads (series/episode info, quality preset)
- Adds media_type to distinguish audio vs video downloads
- Adds is_pinned column to items table for protecting metadata from cache clear