The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
user policy template #223
Duncan Healy7e51dd336550
diff --git a/examples/todo/db/task_list_schema.sql b/examples/todo/db/task_list_schema.sqlindex 30d178f55af..7ab24781d8b 100644--- a/examples/todo/db/task_list_schema.sql+++ b/examples/todo/db/task_list_schema.sql@@ -1,14 +1,22 @@CREATE TABLE lists (uuid text,id bigserial PRIMARY KEY,+ user_id uuid REFERENCES public.users NOT NULL,inserted_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL,updated_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL);+ALTER TABLE lists ENABLE ROW LEVEL SECURITY;+CREATE POLICY "Allow logged-in full access" on lists FOR ALL USING ( auth.role() = 'authenticated' );CREATE TABLE tasks (task_text text NOT NULL,complete boolean DEFAULT false,id bigserial PRIMARY KEY,+ user_id uuid REFERENCES public.users NOT NULL,list_id bigint REFERENCES lists NOT NULL,inserted_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL,updated_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL-);\ No newline at end of file+);+ALTER TABLE tasks ENABLE ROW LEVEL SECURITY;+CREATE POLICY "Allow logged-in read access" on tasks USING ( auth.role() = 'authenticated' );+CREATE POLICY "Allow individual insert access" on tasks FOR INSERT WITH CHECK ( auth.uid() = user_id );+CREATE POLICY "Allow individual update access" on tasks FOR UPDATE USING ( auth.uid() = user_id );\ No newline at end of file