-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupabase_setup.sql
More file actions
27 lines (22 loc) · 833 Bytes
/
supabase_setup.sql
File metadata and controls
27 lines (22 loc) · 833 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
-- Create the bookmarks table
create table bookmarks (
id uuid default uuid_generate_v4() primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
user_id uuid references auth.users not null,
title text not null,
url text not null
);
-- Enable Row Level Security (RLS)
alter table bookmarks enable row level security;
-- Create policies
create policy "Users can view their own bookmarks"
on bookmarks for select
using ( auth.uid() = user_id );
create policy "Users can insert their own bookmarks"
on bookmarks for insert
with check ( auth.uid() = user_id );
create policy "Users can delete their own bookmarks"
on bookmarks for delete
using ( auth.uid() = user_id );
-- Enable Realtime for the bookmarks table
alter publication supabase_realtime add table bookmarks;