-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase_schema.sql
More file actions
33 lines (28 loc) · 1020 Bytes
/
Copy pathsupabase_schema.sql
File metadata and controls
33 lines (28 loc) · 1020 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 a table for Public Profiles
create table templates (
id bigint generated by default as identity primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
title text not null,
category text not null,
sub_category text not null,
price text not null,
tech text[] not null,
image_url text
);
-- Set up Row Level Security (RLS)
-- Enable RLS
alter table templates enable row level security;
-- Policy: Allow everyone to read templates
create policy "Public templates are viewable by everyone"
on templates for select
using ( true );
-- Policy: Allow only authenticated users (admins) to insert/update/delete
create policy "Admins can insert templates"
on templates for insert
with check ( auth.role() = 'authenticated' );
create policy "Admins can update templates"
on templates for update
using ( auth.role() = 'authenticated' );
create policy "Admins can delete templates"
on templates for delete
using ( auth.role() = 'authenticated' );