Skip to content

Commit 768b8b3

Browse files
authored
Merge pull request #1333 from PierreVieira/fix/integration-test-table-grants
fix(integration-test): grant table privileges on test_items to PostgREST roles
2 parents 4c81467 + b03e042 commit 768b8b3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

integration-test/supabase/migrations/20260319000000_create_test_tables.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ CREATE TABLE IF NOT EXISTS public.test_items (
77
user_id UUID REFERENCES auth.users(id)
88
);
99

10+
-- Grant table privileges to the PostgREST roles. Row access is still
11+
-- restricted by the RLS policies below; without these grants every request
12+
-- fails with "permission denied for table test_items" (SQLSTATE 42501).
13+
GRANT SELECT ON public.test_items TO anon;
14+
GRANT SELECT, INSERT, UPDATE, DELETE ON public.test_items TO authenticated;
15+
GRANT ALL ON public.test_items TO service_role;
16+
1017
ALTER TABLE public.test_items ENABLE ROW LEVEL SECURITY;
1118

1219
-- Authenticated users can CRUD their own rows

0 commit comments

Comments
 (0)