-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase_setup.sql
More file actions
33 lines (28 loc) · 1010 Bytes
/
Copy pathsupabase_setup.sql
File metadata and controls
33 lines (28 loc) · 1010 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
31
32
33
-- Create test_results table
create table test_results (
id uuid default uuid_generate_v4() primary key,
name text not null,
age integer not null,
gender text not null,
student_class text not null,
date timestamp with time zone default now(),
results jsonb not null,
dominant_type text not null
);
-- Enable Row Level Security
alter table test_results enable row level security;
-- Create policies
-- Allow anyone to insert test results
create policy "Anyone can insert test results"
on test_results for insert
with check (true);
-- Only authenticated users can view test results
create policy "Authenticated users can view test results"
on test_results for select
using (auth.role() = 'authenticated');
-- Only authenticated users can delete test results
create policy "Authenticated users can delete test results"
on test_results for delete
using (auth.role() = 'authenticated');
-- Comment on table
comment on table test_results is 'Stores results of multiple intelligence test';