-- Add storage provider configuration to system settings
-- AfricanMusic - Storage Provider Configuration

INSERT INTO system_settings (key, value, description) VALUES
('storage_provider', 'vercel-blob', 'Current storage provider: vercel-blob or cloudflare-r2'),
('cloudflare_r2_account_id', '', 'Cloudflare R2 Account ID'),
('cloudflare_r2_access_key', '', 'Cloudflare R2 Access Key'),
('cloudflare_r2_secret_key', '', 'Cloudflare R2 Secret Key'),
('cloudflare_r2_bucket_name', '', 'Cloudflare R2 Bucket Name'),
('cloudflare_r2_public_url', '', 'Cloudflare R2 Public URL')
ON CONFLICT (key) DO NOTHING;

-- Add storage_provider column to tracks for tracking where files are stored
ALTER TABLE tracks ADD COLUMN IF NOT EXISTS storage_provider VARCHAR(50) DEFAULT 'vercel-blob';

-- Add index for faster queries
CREATE INDEX IF NOT EXISTS idx_tracks_storage_provider ON tracks(storage_provider);
