Spaces:
Sleeping
Sleeping
| -- ============================================================ | |
| -- Supabase SQL: Create contact_inquiries table | |
| -- ============================================================ | |
| -- Run this in your Supabase SQL Editor before using the form. | |
| -- ============================================================ | |
| CREATE TABLE IF NOT EXISTS contact_inquiries ( | |
| id UUID DEFAULT gen_random_uuid() PRIMARY KEY, | |
| full_name TEXT NOT NULL, | |
| email TEXT NOT NULL, | |
| age INTEGER NOT NULL, | |
| phone TEXT NOT NULL, | |
| message TEXT, | |
| created_at TIMESTAMPTZ DEFAULT now() | |
| ); | |
| -- Enable RLS (optional but recommended) | |
| ALTER TABLE contact_inquiries ENABLE ROW LEVEL SECURITY; | |
| -- Allow anonymous inserts (form submissions from unauthenticated visitors) | |
| CREATE POLICY "Allow anonymous inserts" | |
| ON contact_inquiries | |
| FOR INSERT | |
| TO anon | |
| WITH CHECK (true); | |
| -- Allow authenticated users to also insert | |
| CREATE POLICY "Allow authenticated inserts" | |
| ON contact_inquiries | |
| FOR INSERT | |
| TO authenticated | |
| WITH CHECK (true); | |
| -- Verify | |
| SELECT column_name, data_type FROM information_schema.columns | |
| WHERE table_name = 'contact_inquiries' | |
| ORDER BY ordinal_position; | |