24 lines
1.0 KiB
SQL
24 lines
1.0 KiB
SQL
-- pack_files: NAS에 저장된 다운로드 가능한 패키지 파일 메타
|
|
-- 운영 적용: Supabase Dashboard → SQL editor에서 실행
|
|
create table if not exists 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 check (size_bytes > 0),
|
|
sort_order integer not null default 0,
|
|
uploaded_at timestamptz not null default now(),
|
|
deleted_at timestamptz
|
|
);
|
|
|
|
-- list 라우트 hot path: deleted_at IS NULL + tier/order 정렬
|
|
create index if not exists pack_files_active_idx
|
|
on public.pack_files (min_tier, sort_order)
|
|
where deleted_at is null;
|
|
|
|
-- soft-deleted 통계 / cleanup 잡 대비
|
|
create index if not exists pack_files_deleted_at_idx
|
|
on public.pack_files (deleted_at)
|
|
where deleted_at is not null;
|