From 7cc8d47ecf87cb1d39aec12ac62a90af98f2580a Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 4 Jan 2026 12:34:23 +0700 Subject: [PATCH] Add public read access to bootcamp curriculum tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enable RLS on bootcamp_modules and bootcamp_lessons tables - Add public SELECT policies so unauthenticated users can view curriculum - This allows kurikulum card to be displayed on bootcamp product detail pages - Both public and authenticated roles can read the curriculum data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- ...50104000001_public_bootcamp_curriculum.sql | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 supabase/migrations/20250104000001_public_bootcamp_curriculum.sql diff --git a/supabase/migrations/20250104000001_public_bootcamp_curriculum.sql b/supabase/migrations/20250104000001_public_bootcamp_curriculum.sql new file mode 100644 index 0000000..094b702 --- /dev/null +++ b/supabase/migrations/20250104000001_public_bootcamp_curriculum.sql @@ -0,0 +1,34 @@ +-- Enable public read access to bootcamp curriculum for product detail pages +-- This allows unauthenticated users to see the curriculum preview + +-- Enable RLS on bootcamp_modules (if not already enabled) +ALTER TABLE bootcamp_modules ENABLE ROW LEVEL SECURITY; + +-- Enable RLS on bootcamp_lessons (if not already enabled) +ALTER TABLE bootcamp_lessons ENABLE ROW LEVEL SECURITY; + +-- Drop existing policies if they exist (to avoid conflicts) +DROP POLICY IF EXISTS "Public can view bootcamp modules" ON bootcamp_modules; +DROP POLICY IF EXISTS "Public can view bootcamp lessons" ON bootcamp_lessons; +DROP POLICY IF EXISTS "Authenticated can view bootcamp modules" ON bootcamp_modules; +DROP POLICY IF EXISTS "Authenticated can view bootcamp lessons" ON bootcamp_lessons; + +-- Create policy for public read access to bootcamp_modules +-- Anyone can view modules to see curriculum preview +CREATE POLICY "Public can view bootcamp modules" +ON bootcamp_modules +FOR SELECT +TO public, authenticated +USING (true); + +-- Create policy for public read access to bootcamp_lessons +-- Anyone can view lessons to see curriculum preview +CREATE POLICY "Public can view bootcamp lessons" +ON bootcamp_lessons +FOR SELECT +TO public, authenticated +USING (true); + +-- Comment explaining the policies +COMMENT ON POLICY "Public can view bootcamp modules" ON bootcamp_modules IS 'Allows public read access to bootcamp curriculum for product detail pages'; +COMMENT ON POLICY "Public can view bootcamp lessons" ON bootcamp_lessons IS 'Allows public read access to bootcamp lessons for curriculum preview';