-- Create the web_drops table CREATE TABLE IF NOT EXISTS public.web_drops ( id BIGSERIAL PRIMARY KEY, user_id TEXT NOT NULL, title TEXT NOT NULL, description TEXT, status TEXT DEFAULT 'ACTIVE', is_external BOOLEAN DEFAULT FALSE, asset_id TEXT, file_url TEXT, image_url TEXT, category TEXT DEFAULT 'sources', published_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); -- Create the vip_users table CREATE TABLE IF NOT EXISTS public.vip_users ( discord_id TEXT PRIMARY KEY, purchased_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, expires_at TIMESTAMP WITH TIME ZONE ); -- Enable Row Level Security (RLS) ALTER TABLE public.web_drops ENABLE ROW LEVEL SECURITY; ALTER TABLE public.vip_users ENABLE ROW LEVEL SECURITY; -- Create policies for public reading CREATE POLICY "Allow public read access on web_drops" ON public.web_drops FOR SELECT USING (true); CREATE POLICY "Allow public read access on vip_users" ON public.vip_users FOR SELECT USING (true); -- Indices for performance CREATE INDEX IF NOT EXISTS idx_web_drops_category ON public.web_drops(category); CREATE INDEX IF NOT EXISTS idx_web_drops_published_at ON public.web_drops(published_at DESC);