Skip to main content

MIGRATION_014

Constant MIGRATION_014 

Source
const MIGRATION_014: &str = r#"
-- Series-specific audio track preferences
-- When user changes audio track for an episode, remember preference for the series
CREATE TABLE IF NOT EXISTS series_audio_preferences (
    user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    series_id TEXT NOT NULL,
    server_id TEXT NOT NULL,

    -- Audio track info for matching across episodes
    audio_track_display_title TEXT,
    audio_track_language TEXT,
    audio_track_index INTEGER,

    updated_at TEXT DEFAULT CURRENT_TIMESTAMP,

    PRIMARY KEY (user_id, series_id, server_id)
);

-- Index for efficient lookups
CREATE INDEX IF NOT EXISTS idx_series_audio_prefs_user_series
  ON series_audio_preferences(user_id, series_id);
"#;
Expand description

Migration to add series audio track preferences

  • Stores user’s preferred audio track per series
  • Matches tracks by display title and language across episodes
  • Falls back to default track if preferred track not found