Spaces:
Sleeping
Sleeping
Download backend/sql/034_music_themes.sql from stylevoice/talk: direct link, hf CLI and curl.
- Browser
- Download file 3.27 kB
-
https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/034_music_themes.sql
- Command line
-
hf download hf://spaces/stylevoice/talk/backend/sql/034_music_themes.sql
-
curl -L -o 034_music_themes.sql https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/034_music_themes.sql
3.27 kB
| -- ์นดํ BGM ๊ธ๋ก๋ฒ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ ์ด๋ธ (2026-05-20, BGM ์๋น์ค Phase 1). | |
| -- | |
| -- ์ฐ๋ฆฌ๊ฐ ์ฌ์ ์์ฑํ PRO-free ์นดํ ๋ฐฐ๊ฒฝ์์ ์นดํ๋ก๊ทธ. Lyria 2 (Vertex AI) ๋ก ์์ฑ โ | |
| -- auto-loop (src/bgm/autoloop.py: seamless loop + -16 LUFS) ํ์ฒ๋ฆฌ โ Supabase | |
| -- Storage('music' ๋ฒํท) ์ ์ฅ โ ์ด ํ ์ด๋ธ์ ๋ฉํ๋ฐ์ดํฐ 1ํ. | |
| -- | |
| -- ์ฌ์ ๊ฒฝ๋ก๋ GPU/API 0 โ ํญ์ Storage ํ์ผ ์๋น (signed URL). ์ด ํ ์ด๋ธ์ ์นดํ๋ก๊ทธ | |
| -- (๋ชฉ๋ก/๋ฌด๋ ํํฐ/๊ฒ์) ์ฉ. ์ฌ์ฉ์ ๊ฐ์ธ ์์ฑ๊ณก์ ๋ณ๋ user_music ํ ์ด๋ธ(Phase 4). | |
| -- | |
| -- ํ๊ท 0 ๊ฐ๋: | |
| -- - ์ ๊ท ํ ์ด๋ธ โ ๊ธฐ์กด TTS/voice/playlist/care ์คํค๋ง ์ํฅ 0. | |
| -- - RLS: ๊ธ๋ก๋ฒ ์นดํ๋ก๊ทธ๋ผ ์ธ์ฆ ์ฌ์ฉ์ + anon ์ฝ๊ธฐ ํ์ฉ(public read). ์ฐ๊ธฐ๋ | |
| -- service_role ๋ง (๋ฐฐ์น ๋น๋๊ฐ service_role ํค ์ฌ์ฉ) โ ๊ธฐ๋ณธ deny ๋ก ์ฌ์ฉ์ ์ฐ๊ธฐ ์ฐจ๋จ. | |
| -- - storage_path ๋ 'music' ๋ฒํท ๋ด ์๋ ๊ฒฝ๋ก๋ง ์ ์ฅ (๋ฒํท๋ช ๋นํฌํจ) โ ๋ฒํท ์ด์ ๋๋น. | |
| -- | |
| -- ์ดํ ๋จ๊ณ: | |
| -- 1) ์ด SQL ์ ์ฉ (Supabase SQL editor ๋๋ ๋ง์ด๊ทธ๋ ์ด์ ๋ฌ๋) | |
| -- 2) Storage 'music' ๋ฒํท ์์ฑ (๋ฐฐ์น ๋น๋๊ฐ ์์ผ๋ฉด ์๋ ์์ฑ ์๋) | |
| -- 3) scripts/bgm_library/build_library.py ๋ก ๋ฐฐ์น ์์ฑ โ ํ insert | |
| -- 4) (Phase 2+) backend ๋ผ์ฐํฐ๊ฐ ์นดํ๋ก๊ทธ ์กฐํ + signed URL ๋ฐ๊ธ | |
| -- | |
| -- ์ฐธ์กฐ: project_bgm_service (memory), src/bgm/autoloop.py | |
| CREATE TABLE IF NOT EXISTS public.music_themes ( | |
| id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| title text NOT NULL, | |
| genre text NOT NULL DEFAULT '', | |
| mood_tags text[] NOT NULL DEFAULT '{}', | |
| -- ์ฌํ/๊ฐ์ฌ์ฉ: ์์ฑ ํ๋ผ๋ฏธํฐ ๋ฐ์ (Lyria 2) | |
| prompt text NOT NULL DEFAULT '', | |
| negative_prompt text NOT NULL DEFAULT '', | |
| seed bigint, | |
| -- ์ค๋์ค ์์ฐ | |
| storage_path text NOT NULL, -- 'music' ๋ฒํท ๋ด ์๋ ๊ฒฝ๋ก (์: themes/lofi/xxx.mp3) | |
| duration_sec real, | |
| bpm real, | |
| -- auto-loop QC ์งํ (๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ์ง ์ถ์ ) | |
| lufs real, | |
| qc_pop_ratio real, | |
| qc_rms_ratio real, | |
| qc_passed boolean NOT NULL DEFAULT true, | |
| -- ์ด์ | |
| is_active boolean NOT NULL DEFAULT true, | |
| created_at timestamptz NOT NULL DEFAULT now() | |
| ); | |
| -- ๋ฌด๋ ํํฐ ์กฐํ (์: mood_tags @> '{lofi}') | |
| CREATE INDEX IF NOT EXISTS music_themes_mood_tags_idx | |
| ON public.music_themes USING gin (mood_tags); | |
| CREATE INDEX IF NOT EXISTS music_themes_active_idx | |
| ON public.music_themes (is_active, created_at DESC); | |
| -- ๋์ผ (path) ์ค๋ณต ๋ฐฉ์ง (๋ฐฐ์น ์ฌ์คํ idempotency) | |
| CREATE UNIQUE INDEX IF NOT EXISTS music_themes_storage_path_key | |
| ON public.music_themes (storage_path); | |
| ALTER TABLE public.music_themes ENABLE ROW LEVEL SECURITY; | |
| -- ๊ธ๋ก๋ฒ ์นดํ๋ก๊ทธ: ํ์ฑ ํ์ ๋๊ตฌ๋ ์ฝ๊ธฐ (์ฌ์ ๊ฒฝ๋ก). ์ฐ๊ธฐ ์ ์ฑ ์์ = service_role ๋ง. | |
| DROP POLICY IF EXISTS music_themes_public_read ON public.music_themes; | |
| CREATE POLICY music_themes_public_read ON public.music_themes | |
| FOR SELECT | |
| USING (is_active = true); | |
| COMMENT ON TABLE public.music_themes IS | |
| '์นดํ BGM ๊ธ๋ก๋ฒ ๋ผ์ด๋ธ๋ฌ๋ฆฌ (Lyria 2 ์์ฑ + auto-loop). ์ฌ์=Storage signed URL.'; | |