Appearance
09. supabase-support-attachments.sql
원본 파일: 'C:\Repository\loafacto-hub\docs\web-ui\09. supabase-support-attachments.sql'
sql
-- =============================================================================
-- support 테이블: 첨부파일 URL 컬럼 추가 + Storage 버킷 (문의/제보 파일 첨부용)
-- 08. supabase-support-table.sql 적용 후 실행하세요.
-- =============================================================================
-- 첨부파일 공개 URL 목록 (Supabase Storage 업로드 후 저장)
ALTER TABLE public.support
ADD COLUMN IF NOT EXISTS attachment_urls text[] NOT NULL DEFAULT '{}';
COMMENT ON COLUMN public.support.attachment_urls IS '첨부파일 공개 URL 목록 (support-attachments 버킷)';
-- 원본 파일명 (attachment_urls와 동일 순서, 표시용)
ALTER TABLE public.support
ADD COLUMN IF NOT EXISTS attachment_names text[] NOT NULL DEFAULT '{}';
COMMENT ON COLUMN public.support.attachment_names IS '첨부파일 원본 파일명 (표시용, attachment_urls와 1:1 대응)';
-- Storage 버킷: Supabase Dashboard > Storage > New bucket
-- 이름: support-attachments, Public: true (또는 signed URL 사용 시 false)
-- RLS 정책 예시 (인증된 사용자만 업로드, 본인 경로만):
CREATE POLICY "Users can upload support attachments"
ON storage.objects FOR INSERT TO authenticated
WITH CHECK (bucket_id = 'support-attachments');
CREATE POLICY "Public read for support attachments"
ON storage.objects FOR SELECT TO public
USING (bucket_id = 'support-attachments');