diff --git a/supabase/migrations/20250224164421_init.sql b/supabase/migrations/20250224164421_init.sql index 718e09b..ec42e4e 100644 --- a/supabase/migrations/20250224164421_init.sql +++ b/supabase/migrations/20250224164421_init.sql @@ -182,4 +182,16 @@ SELECT status from users WHERE username = name_param; $$ - LANGUAGE SQL IMMUTABLE; \ No newline at end of file + LANGUAGE SQL IMMUTABLE; + +-- Tables created by the `postgres` role in the `public` schema no longer inherit +-- SELECT/INSERT/UPDATE/DELETE for the API roles under current Supabase CLI default privileges +-- (https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically), +-- so the privileges must be granted explicitly. +grant select, insert, update, delete on all tables in schema public to anon, authenticated, service_role; +grant usage, select on all sequences in schema public to anon, authenticated, service_role; +grant execute on all functions in schema public to anon, authenticated, service_role; + +alter default privileges in schema public grant select, insert, update, delete on tables to anon, authenticated, service_role; +alter default privileges in schema public grant usage, select on sequences to anon, authenticated, service_role; +alter default privileges in schema public grant execute on functions to anon, authenticated, service_role; \ No newline at end of file