Set up todo list for Supabase Svelte Todo List example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- For use with: | |
-- https://github.com/supabase/supabase/tree/master/examples/todo-list/nextjs-todo-list or | |
-- https://github.com/supabase/supabase/tree/master/examples/todo-list/react-todo-list or | |
-- https://github.com/supabase/supabase/tree/master/examples/todo-list/sveltejs-todo-list or | |
-- https://github.com/supabase/supabase/tree/master/examples/todo-list/vue3-ts-todo-list | |
-- | |
create table todos ( | |
id bigint generated by default as identity primary key, | |
user_id uuid references auth.users not null, | |
task text check (char_length(task) > 3), | |
is_complete boolean default false, | |
inserted_at timestamp with time zone default timezone('utc'::text, now()) not null | |
); | |
alter table todos enable row level security; | |
create policy "Individuals can create todos." on todos for | |
insert with check (auth.uid() = user_id); | |
create policy "Individuals can view their own todos. " on todos for | |
select using (auth.uid() = user_id); | |
create policy "Individuals can update their own todos." on todos for | |
update using (auth.uid() = user_id); | |
create policy "Individuals can delete their own todos." on todos for | |
delete using (auth.uid() = user_id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment