tuladha-api / sql /create_contact_inquiries.sql
Fahmi Syahputra
Initial commit for Backend
49bd31a
Raw
History Blame Contribute Delete
1.21 kB
-- ============================================================
-- 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;