forked from IshaanSirbhaiya/DeepLearning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase_schema.sql
More file actions
36 lines (29 loc) · 1.63 KB
/
Copy pathsupabase_schema.sql
File metadata and controls
36 lines (29 loc) · 1.63 KB
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
-- Run this SQL in your Supabase SQL Editor to set up the full schema.
-- ── Evacuees table ────────────────────────────────────────────────────────────
CREATE TABLE evacuees (
id SERIAL PRIMARY KEY,
name TEXT,
chat_id TEXT,
status TEXT, -- 'secure' | 'safe' | 'unaccounted' | 'sos' | 'endangered'
location_link TEXT, -- Google Maps URL e.g. https://maps.google.com/maps?q=1.344,103.682
last_update TIMESTAMPTZ DEFAULT NOW()
);
ALTER TABLE evacuees ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Public can read evacuees" ON evacuees FOR SELECT USING (true);
CREATE POLICY "Public can insert evacuees" ON evacuees FOR INSERT WITH CHECK (true);
CREATE POLICY "Public can update evacuees" ON evacuees FOR UPDATE USING (true);
-- ── Hazards table ─────────────────────────────────────────────────────────────
CREATE TABLE hazards (
id SERIAL PRIMARY KEY,
name TEXT, -- e.g., "The Hive Fire"
latitude FLOAT,
longitude FLOAT,
status TEXT DEFAULT 'active', -- 'active' | 'contained'
reported_at TIMESTAMPTZ DEFAULT NOW()
);
ALTER TABLE hazards ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Allow everything for demo" ON public.hazards
FOR ALL TO public USING (true) WITH CHECK (true);
-- Example insert:
-- INSERT INTO hazards (name, latitude, longitude, status)
-- VALUES ('The Hive Fire', 1.34321, 103.68275, 'active');