-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase-tables.sql
More file actions
30 lines (26 loc) · 1012 Bytes
/
Copy pathsupabase-tables.sql
File metadata and controls
30 lines (26 loc) · 1012 Bytes
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
-- Run this SQL in your Supabase Dashboard → SQL Editor
-- Create contacts table
CREATE TABLE IF NOT EXISTS contacts (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL,
subject TEXT NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
is_read INTEGER DEFAULT 0,
tags TEXT DEFAULT '[]'
);
-- Create activity_logs table
CREATE TABLE IF NOT EXISTS activity_logs (
id SERIAL PRIMARY KEY,
action TEXT NOT NULL,
details TEXT,
timestamp TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Enable Row Level Security (optional - since we're using service role key)
-- ALTER TABLE contacts ENABLE ROW LEVEL SECURITY;
-- ALTER TABLE activity_logs ENABLE ROW LEVEL SECURITY;
-- Create indexes for better performance
CREATE INDEX IF NOT EXISTS idx_contacts_created_at ON contacts(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_contacts_is_read ON contacts(is_read);
CREATE INDEX IF NOT EXISTS idx_activity_logs_timestamp ON activity_logs(timestamp DESC);