Rebuild KPIs as a real dashboard (period deltas, tenant zoom), clarify objetivos/calendario/activos sources, and turn creatives into a status pipeline with delete. Co-authored-by: Cursor <cursoragent@cursor.com>
12 lines
430 B
SQL
12 lines
430 B
SQL
-- Allow tenant-scoped delete on creatives (clients); agency uses service role.
|
|
alter table public.creatives enable row level security;
|
|
|
|
drop policy if exists creatives_tenant_delete on public.creatives;
|
|
create policy creatives_tenant_delete on public.creatives
|
|
for delete using (
|
|
tenant_id::text = coalesce(
|
|
auth.jwt() -> 'app_metadata' ->> 'tenant_id',
|
|
auth.jwt() -> 'user_metadata' ->> 'tenant_id'
|
|
)
|
|
);
|