-- Create exercise_videos table
CREATE TABLE IF NOT EXISTS exercise_videos (
  id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
  workout_id UUID NOT NULL,
  trainer_id UUID NOT NULL,
  exercise_name TEXT NOT NULL,
  video_url TEXT NOT NULL,
  video_path TEXT NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Enable RLS
ALTER TABLE exercise_videos ENABLE ROW LEVEL SECURITY;

-- Public policies
DROP POLICY IF EXISTS "Public read access exercise_videos" ON exercise_videos;
DROP POLICY IF EXISTS "Public insert access exercise_videos" ON exercise_videos;
DROP POLICY IF EXISTS "Public update access exercise_videos" ON exercise_videos;
DROP POLICY IF EXISTS "Public delete access exercise_videos" ON exercise_videos;

CREATE POLICY "Public read access exercise_videos" ON exercise_videos FOR SELECT USING (true);
CREATE POLICY "Public insert access exercise_videos" ON exercise_videos FOR INSERT WITH CHECK (true);
CREATE POLICY "Public update access exercise_videos" ON exercise_videos FOR UPDATE USING (true);
CREATE POLICY "Public delete access exercise_videos" ON exercise_videos FOR DELETE USING (true);
