update config, admin-web tooling & relocate agent skills
Update app.json config and add new dependencies in package.json. Update .gitignore for new patterns. Add timed-exercise editor/list components, warmup/stretch video migration, and Supabase helpers in admin-web. Relocate agent skills from .agents/skills/ to .opencode/skills/.
This commit is contained in:
71
admin-web/migrations/006_warmup_stretch_video.sql
Normal file
71
admin-web/migrations/006_warmup_stretch_video.sql
Normal file
@@ -0,0 +1,71 @@
|
||||
-- Migration 006: Warmup, Stretch, and Exercise Video URLs
|
||||
-- Extends workout_programs with warmup and stretch blocks
|
||||
-- Adds video_url to tabata exercises for background playback during player
|
||||
|
||||
-- ─── Add video URLs to tabata exercises ─────────────────────
|
||||
|
||||
ALTER TABLE public.program_tabatas
|
||||
ADD COLUMN IF NOT EXISTS exercise_1_video_url TEXT,
|
||||
ADD COLUMN IF NOT EXISTS exercise_2_video_url TEXT;
|
||||
|
||||
-- ─── Warmup Exercises ───────────────────────────────────────
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.workout_warmup_exercises (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
program_id UUID NOT NULL REFERENCES public.workout_programs(id) ON DELETE CASCADE,
|
||||
position INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
name_en TEXT,
|
||||
tip TEXT,
|
||||
tip_en TEXT,
|
||||
duration INTEGER NOT NULL, -- seconds
|
||||
video_url TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
UNIQUE (program_id, position)
|
||||
);
|
||||
|
||||
-- ─── Stretch Exercises ──────────────────────────────────────
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.workout_stretch_exercises (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
program_id UUID NOT NULL REFERENCES public.workout_programs(id) ON DELETE CASCADE,
|
||||
position INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
name_en TEXT,
|
||||
tip TEXT,
|
||||
tip_en TEXT,
|
||||
duration INTEGER NOT NULL, -- seconds
|
||||
video_url TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
UNIQUE (program_id, position)
|
||||
);
|
||||
|
||||
-- ─── Indexes ────────────────────────────────────────────────
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_warmup_program_position
|
||||
ON public.workout_warmup_exercises (program_id, position);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_stretch_program_position
|
||||
ON public.workout_stretch_exercises (program_id, position);
|
||||
|
||||
-- ─── Row Level Security ─────────────────────────────────────
|
||||
|
||||
ALTER TABLE public.workout_warmup_exercises ENABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE public.workout_stretch_exercises ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
CREATE POLICY "Public read workout_warmup_exercises"
|
||||
ON public.workout_warmup_exercises FOR SELECT USING (true);
|
||||
|
||||
CREATE POLICY "Public read workout_stretch_exercises"
|
||||
ON public.workout_stretch_exercises FOR SELECT USING (true);
|
||||
|
||||
-- Admin write (service_role bypass RLS, authenticated users controlled elsewhere)
|
||||
CREATE POLICY "Admin write workout_warmup_exercises"
|
||||
ON public.workout_warmup_exercises FOR ALL
|
||||
USING (auth.role() = 'service_role')
|
||||
WITH CHECK (auth.role() = 'service_role');
|
||||
|
||||
CREATE POLICY "Admin write workout_stretch_exercises"
|
||||
ON public.workout_stretch_exercises FOR ALL
|
||||
USING (auth.role() = 'service_role')
|
||||
WITH CHECK (auth.role() = 'service_role');
|
||||
Reference in New Issue
Block a user