From ace46fb2aeae3664e11ff868b61272ad65ae872a Mon Sep 17 00:00:00 2001 From: gahusb Date: Sat, 2 May 2026 08:58:39 +0900 Subject: [PATCH] =?UTF-8?q?feat(db):=20pack=5Ffiles=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=E2=80=94=20Phase=202=20=EC=9E=90=EB=A3=8C=20?= =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20SSOT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- .../2026-05-02-create-pack-files.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 supabase/migrations/2026-05-02-create-pack-files.sql diff --git a/supabase/migrations/2026-05-02-create-pack-files.sql b/supabase/migrations/2026-05-02-create-pack-files.sql new file mode 100644 index 0000000..66b871f --- /dev/null +++ b/supabase/migrations/2026-05-02-create-pack-files.sql @@ -0,0 +1,21 @@ +-- Phase 2: pack_files 테이블 — Music 팩 자료 메타데이터 SSOT + +create table public.pack_files ( + id uuid primary key default gen_random_uuid(), + min_tier text not null check (min_tier in ('starter', 'pro', 'master')), + label text not null, + file_path text not null unique, + filename text not null, + size_bytes bigint not null, + sort_order int not null default 0, + uploaded_at timestamptz not null default now(), + deleted_at timestamptz +); + +create index idx_pack_files_tier on public.pack_files(min_tier, sort_order) + where deleted_at is null; + +alter table public.pack_files enable row level security; + +-- 일반 사용자 직접 SELECT 차단. /api/packs/* 라우트가 service role로 조회. +-- (RLS enabled + 정책 미정의 → 모든 anon/authenticated SELECT 거부)