supabase: extend initial migration and add first campaigns test
This commit is contained in:
19
supabase/migrations/20250926150848_campaigns.sql
Normal file
19
supabase/migrations/20250926150848_campaigns.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
create table public.campaigns (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
created_at timestamp with time zone not null default now(),
|
||||
brand_id uuid not null references public.brands(user_id) on delete cascade,
|
||||
description text not null default ''::text
|
||||
);
|
||||
alter table public.campaigns enable row level security;
|
||||
create policy everyone_view_only
|
||||
on public.campaigns
|
||||
as permissive
|
||||
for select
|
||||
to authenticated, anon
|
||||
using (true);
|
||||
create policy users_manage_their_own_data
|
||||
on public.campaigns
|
||||
as permissive
|
||||
for all
|
||||
to authenticated
|
||||
using ((( SELECT auth.uid() AS uid) = brand_id));
|
||||
Reference in New Issue
Block a user