-- ============================================
-- DUAL AVATAR URL COLUMNS
-- Separate columns for S3 and local storage URLs
-- ============================================

-- Add separate columns for S3 and local (Supabase Storage) avatar URLs
-- This allows switching between storage backends without losing URLs

-- Add local avatar URL column
ALTER TABLE public.members ADD COLUMN IF NOT EXISTS avatar_url_local TEXT;

-- Add S3 avatar URL column
ALTER TABLE public.members ADD COLUMN IF NOT EXISTS avatar_url_s3 TEXT;

-- Add avatar storage path column (for deletion purposes)
ALTER TABLE public.members ADD COLUMN IF NOT EXISTS avatar_path TEXT;

-- Comment explaining the columns
COMMENT ON COLUMN public.members.avatar_url IS 'Current active avatar URL (computed based on storage setting)';
COMMENT ON COLUMN public.members.avatar_url_local IS 'Avatar URL when stored in Supabase Storage';
COMMENT ON COLUMN public.members.avatar_url_s3 IS 'Avatar URL when stored in S3/MinIO';
COMMENT ON COLUMN public.members.avatar_path IS 'Storage path for avatar file (e.g., member_id/avatar.jpg)';
