fix: add chat session delete row policy (#21)

This commit is contained in:
732642856
2026-07-21 12:15:12 +08:00
committed by GitHub
parent 65b8c422bf
commit 5db48e16b3
2 changed files with 9 additions and 0 deletions
@@ -1,5 +1,12 @@
begin;
drop policy if exists chat_sessions_delete_own on public.chat_sessions;
create policy chat_sessions_delete_own
on public.chat_sessions
for delete
to authenticated
using ((select auth.uid()) = user_id);
grant delete on table public.chat_sessions to authenticated;
commit;
@@ -45,3 +45,5 @@ def test_chat_session_delete_is_server_controlled_and_granted() -> None:
assert '.eq("user_id", user.id)' in route
assert 'count !== 1' in route
assert 'grant delete on table public.chat_sessions to authenticated' in migration.lower()
assert 'create policy chat_sessions_delete_own' in migration.lower()
assert 'using ((select auth.uid()) = user_id)' in migration.lower()