Spaces:
Sleeping
Sleeping
Download backend/sql/042_timeline_samples.sql from stylevoice/talk: direct link, hf CLI and curl.
- Browser
- Download file 2.93 kB
-
https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/042_timeline_samples.sql
- Command line
-
hf download hf://spaces/stylevoice/talk/backend/sql/042_timeline_samples.sql
-
curl -L -o 042_timeline_samples.sql https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/042_timeline_samples.sql
2.93 kB
| -- μΉ΄ν BGM μν νΈμ±ν DBν (2026-05-25). | |
| -- | |
| -- κΈ°μ‘΄: μν(μ€νλ² μ€/μ¬λ¦¬λΈμ)μ΄ νλ‘ νΈ νλμ½λ© β κ΄λ¦¬μκ° νΈμ§/μ μ₯ν΄λ μμ μ λ¨. | |
| -- λ³κ²½: μνμ μ€μ music_timelines ν(is_sample=true)μΌλ‘ λ§λ€μ΄ κ΄λ¦¬μ νΈμ§μ΄ μμ + | |
| -- λͺ¨λ μ¬μ©μκ° κ°μ μνμ λ΄. owner = κ΄λ¦¬μ(icesgg). μ½κΈ°λ λꡬλ, μ°κΈ°λ κ΄λ¦¬μλ§ | |
| -- (λ°±μλ timeline_service κ°λ + μλ RLS public read). | |
| -- | |
| -- νκ· 0: μ»¬λΌ μΆκ°(nullable/default) + μ κ· RLSλ SELECT λ§ μΆκ°(κΈ°μ‘΄ owner FOR ALL μ μ§). | |
| ALTER TABLE public.music_timelines | |
| ADD COLUMN IF NOT EXISTS is_sample boolean NOT NULL DEFAULT false, | |
| ADD COLUMN IF NOT EXISTS description text, | |
| ADD COLUMN IF NOT EXISTS genre text, | |
| ADD COLUMN IF NOT EXISTS time_label text; | |
| CREATE INDEX IF NOT EXISTS music_timelines_sample_idx | |
| ON public.music_timelines (is_sample) WHERE is_sample; | |
| -- κ³΅μ© μνμ λꡬλ μ½κΈ° (owner μ μ© μ μ± μ SELECT ν μ€ μΆκ° β permissive OR). | |
| -- λ°±μλλ service_role λ‘ μ°ννμ§λ§ RLS λ λ°©μ΄μ μΌλ‘ λ§μΆ°λλ€. | |
| DROP POLICY IF EXISTS music_timelines_sample_read ON public.music_timelines; | |
| CREATE POLICY music_timelines_sample_read ON public.music_timelines | |
| FOR SELECT USING (is_sample = true); | |
| DROP POLICY IF EXISTS timeline_items_sample_read ON public.timeline_items; | |
| CREATE POLICY timeline_items_sample_read ON public.timeline_items | |
| FOR SELECT USING ( | |
| EXISTS (SELECT 1 FROM public.music_timelines t | |
| WHERE t.id = timeline_items.timeline_id AND t.is_sample = true) | |
| ); | |
| -- μν 2κ° μλ (owner = κ΄λ¦¬μ). λ©±λ± β κ°μ name μ μνμ΄ μ΄λ―Έ μμΌλ©΄ skip. | |
| INSERT INTO public.music_timelines (user_id, name, is_sample, description, genre, time_label) | |
| SELECT u.id, 'μ€νλ² μ€ λ§€μ₯ νλ μ΄ λ¦¬μ€νΈ', true, | |
| 'μΈλ ¨λ μ¬μ¦μ λΆλλ¬μ΄ μμΏ μ€ν± μμ μ΄ μ‘°ν©λ μ€νλ² μ€ μ€νμΌ νΈμ±νμ λλ€.', | |
| 'JAZZ', '08:00 - 11:00' | |
| FROM auth.users u | |
| WHERE u.email = 'icesgg@gmail.com' | |
| AND NOT EXISTS ( | |
| SELECT 1 FROM public.music_timelines | |
| WHERE is_sample = true AND name = 'μ€νλ² μ€ λ§€μ₯ νλ μ΄ λ¦¬μ€νΈ'); | |
| INSERT INTO public.music_timelines (user_id, name, is_sample, description, genre, time_label) | |
| SELECT u.id, 'μ¬λ¦¬λΈμ μ΅μ νΈλ λ ν', true, | |
| 'νκΈ°μ°¬ λ§€μ₯ λΆμκΈ°λ₯Ό μν μ΅μ μΈκΈ° νκ³Ό λΈλλ 곡μ§μ¬νμ΄ ν¬ν¨λ ꡬμ±μ λλ€.', | |
| 'TRENDY', '11:30 - 14:00' | |
| FROM auth.users u | |
| WHERE u.email = 'icesgg@gmail.com' | |
| AND NOT EXISTS ( | |
| SELECT 1 FROM public.music_timelines | |
| WHERE is_sample = true AND name = 'μ¬λ¦¬λΈμ μ΅μ νΈλ λ ν'); | |
| COMMENT ON COLUMN public.music_timelines.is_sample IS | |
| 'κ³΅μ© μν νΈμ±ν(ν νλ¦Ώ). true=λͺ¨λ μ¬μ©μ λ ΈμΆ, κ΄λ¦¬μλ§ νΈμ§. λ΄ νΈμ±ν λͺ©λ‘ μ μΈ.'; | |