Skip to content

Commit

Permalink
feat: add additional permissions to postgres user for views
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan-Kim2028 committed Nov 22, 2024
1 parent 374195b commit 69f3412
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sql/postgrest/init-postgrest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@ GRANT SELECT ON ALL TABLES IN SCHEMA api TO anon;
-- Grant select on all FUTURE tables in api schema to anon
ALTER DEFAULT PRIVILEGES IN SCHEMA api GRANT SELECT ON TABLES TO anon;

GRANT anon TO postgres;
GRANT anon TO postgres;

-- Grant specific permissions for materialized view operations
GRANT CREATE ON SCHEMA api TO postgres;
GRANT ALL ON ALL MATERIALIZED VIEWS IN SCHEMA api TO postgres;

-- Ensure postgres can create and refresh materialized views
ALTER DEFAULT PRIVILEGES IN SCHEMA api
GRANT ALL ON MATERIALIZED VIEWS TO postgres;

-- Allow postgres to create indexes
GRANT ALL ON ALL SEQUENCES IN SCHEMA api TO postgres;

0 comments on commit 69f3412

Please sign in to comment.