SupabaseS
Supabasethis hour
Aron

Setup custom schema on self-host

I created a custom schema. Trying to access it via supabase-js gives me following error:

{
  code: "PGRST106",
  details: null,
  hint: "Only the following schemas are exposed: public, storage, graphql_public",
  message: "Invalid schema: myschema",
}


I used following commands to create the schema:

CREATE SCHEMA myschema;

GRANT USAGE ON SCHEMA myschema TO anon, authenticated, service_role;
GRANT ALL ON ALL TABLES IN SCHEMA myschema TO anon, authenticated, service_role;
GRANT ALL ON ALL ROUTINES IN SCHEMA myschema TO anon, authenticated, service_role;
GRANT ALL ON ALL SEQUENCES IN SCHEMA myschema TO anon, authenticated, service_role;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON TABLES TO anon, authenticated, service_role;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON ROUTINES TO anon, authenticated, service_role;
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON SEQUENCES TO anon, authenticated, service_role;


I could create a table in that schema via sql and it shows up in the studio.

Adding the schema to exposed schemas via https://mydomain.com/project/default/settings/api gives me following error:

Failed to update Postgres config: API error happend while trying to communicate with the server.


How to configure this when self-hosting?
image.png
Was this page helpful?