Spaces:
Runtime error
Runtime error
Download supabase_setup.sql from TrinetraLabs/PlaceboAI: direct link, hf CLI and curl.
- Browser
- Download file 830 Bytes
-
https://huggingface.co/spaces/TrinetraLabs/PlaceboAI/resolve/main/supabase_setup.sql
- Command line
-
hf download hf://spaces/TrinetraLabs/PlaceboAI/supabase_setup.sql
-
curl -L -o supabase_setup.sql https://huggingface.co/spaces/TrinetraLabs/PlaceboAI/resolve/main/supabase_setup.sql
830 Bytes
| -- Create the Chat History Table | |
| CREATE TABLE IF NOT EXISTS public.chat_history ( | |
| id UUID DEFAULT uuid_generate_v4() PRIMARY KEY, | |
| user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE, | |
| query TEXT NOT NULL, | |
| answer TEXT NOT NULL, | |
| sources JSONB DEFAULT '[]'::jsonb, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL | |
| ); | |
| -- Turn on Row Level Security (RLS) | |
| ALTER TABLE public.chat_history ENABLE ROW LEVEL SECURITY; | |
| -- Allow users to insert their own chats | |
| CREATE POLICY "Users can insert their own chat history" | |
| ON public.chat_history FOR INSERT | |
| TO authenticated | |
| WITH CHECK (auth.uid() = user_id); | |
| -- Allow users to view their own chats | |
| CREATE POLICY "Users can view their own chat history" | |
| ON public.chat_history FOR SELECT | |
| TO authenticated | |
| USING (auth.uid() = user_id); | |