ALTER TABLE voice_ai_sessions ADD COLUMN IF NOT EXISTS media_uuid TEXT;
ALTER TABLE voice_ai_sessions ADD COLUMN IF NOT EXISTS media_status TEXT;
ALTER TABLE voice_ai_sessions ADD COLUMN IF NOT EXISTS media_connected_at TEXT;
ALTER TABLE voice_ai_sessions ADD COLUMN IF NOT EXISTS media_ended_at TEXT;
ALTER TABLE voice_ai_sessions ADD COLUMN IF NOT EXISTS last_media_frame_at TEXT;

CREATE INDEX IF NOT EXISTS idx_voice_ai_sessions_media_uuid ON voice_ai_sessions(media_uuid);
CREATE INDEX IF NOT EXISTS idx_voice_ai_sessions_media_status ON voice_ai_sessions(media_status);
CREATE INDEX IF NOT EXISTS idx_voice_ai_sessions_media_connected_at ON voice_ai_sessions(media_connected_at);
CREATE INDEX IF NOT EXISTS idx_voice_ai_sessions_media_ended_at ON voice_ai_sessions(media_ended_at);
CREATE INDEX IF NOT EXISTS idx_voice_ai_sessions_last_media_frame_at ON voice_ai_sessions(last_media_frame_at);
