supabase: extend initial migration and add first campaigns test

This commit is contained in:
2025-09-26 17:25:01 +02:00
parent f5ec337cf4
commit c829f019f1
2 changed files with 61 additions and 12 deletions

View 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));