-- 允许工作空间成员删除媒体资源，保持与插入/更新策略一致
alter table public.media_assets enable row level security;

drop policy if exists "Delete assets within workspace" on public.media_assets;
create policy "Delete assets within workspace"
    on public.media_assets
    for delete
    using (
        exists (
            select 1
            from public.workspace_members wm
            where wm.workspace_id = media_assets.workspace_id
              and wm.user_id = auth.uid()
        )
    );
