Skip to main content

## MIGRATION_011

# Constant MIGRATION_011

Source

    const MIGRATION_011: &str = r#"
    -- User-specific player settings (autoplay and audio settings)
    -- Sleep timer is NOT persisted here (maintained in-memory only)
    CREATE TABLE IF NOT EXISTS user_player_settings (
        user_id TEXT PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,

        -- Autoplay settings
        autoplay_next_episode INTEGER DEFAULT 1,  -- 1 = enabled, 0 = disabled
        autoplay_countdown_seconds INTEGER DEFAULT 10,  -- 5-30 seconds

        -- Audio settings (crossfade, normalization)
        crossfade_duration REAL DEFAULT 0.0,  -- 0-12 seconds
        gapless_playback INTEGER DEFAULT 1,
        normalize_volume INTEGER DEFAULT 0,
        volume_level TEXT DEFAULT 'normal',  -- 'loud', 'normal', 'quiet'

        updated_at TEXT DEFAULT CURRENT_TIMESTAMP
    );

    -- Index for efficient user settings lookup
    CREATE INDEX IF NOT EXISTS idx_user_player_settings_user ON user_player_settings(user_id);
    "#;

Expand description

Migration to add user-specific player settings

- Creates user_player_settings table for autoplay and audio preferences
- Note: Sleep timer state is NOT persisted (cancelled on app close)
- Autoplay settings control next episode behavior
- Audio settings for crossfade, gapless playback, and volume normalization