Files
PastpaperMaster/supabase/migrations/008_fix_storage_url_placeholder.sql
Zhao 7a09167261 Initial commit: PastPaper Master full stack
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 12:27:47 +07:00

28 lines
1.0 KiB
SQL

-- 008: Replace __SUPABASE_STORAGE_PUBLIC_BASE_URL__ placeholder in paper URLs
--
-- The course-library seed (comp2211_course_library_papers.sql) was inserted
-- without substituting the placeholder. This migration replaces it with the
-- real Supabase Storage public base URL for the `papers` bucket.
UPDATE papers
SET paper_file_url = REPLACE(
paper_file_url,
'__SUPABASE_STORAGE_PUBLIC_BASE_URL__',
'https://pvcxipwovpwrurebouwg.supabase.co/storage/v1/object/public/papers'
)
WHERE paper_file_url LIKE '%__SUPABASE_STORAGE_PUBLIC_BASE_URL__%';
UPDATE papers
SET answer_file_url = REPLACE(
answer_file_url,
'__SUPABASE_STORAGE_PUBLIC_BASE_URL__',
'https://pvcxipwovpwrurebouwg.supabase.co/storage/v1/object/public/papers'
)
WHERE answer_file_url LIKE '%__SUPABASE_STORAGE_PUBLIC_BASE_URL__%';
-- Verify: should return 0 rows
SELECT id, course_code, year, term, exam_type, paper_file_url, answer_file_url
FROM papers
WHERE paper_file_url LIKE '%__SUPABASE_STORAGE_PUBLIC_BASE_URL__%'
OR answer_file_url LIKE '%__SUPABASE_STORAGE_PUBLIC_BASE_URL__%';