eduproj2/supabase/migrations/20230618024722_init.sql

19 lines
689 B
MySQL
Raw Normal View History

2023-08-01 22:38:06 +00:00
create table if not exists todos (
id uuid default gen_random_uuid() primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
title text,
is_complete boolean default false,
user_id uuid references auth.users default auth.uid()
);
-- Set up Row Level Security (RLS)
-- See https://supabase.com/docs/guides/auth/row-level-security for more details.
alter table todos
enable row level security;
create policy "Authenticated users can select todos" on todos
for select to authenticated using (true);
create policy "Authenticated users can insert their own todos" on todos
for insert to authenticated with check (auth.uid() = user_id);