File size: 1,208 Bytes
49bd31a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- ============================================================
-- 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;