Using Custom Schemas
By default, your database has a public
schema which is automatically exposed on data APIs. You can also expose custom database schemas - to do so you need to follow these steps:
- Go to API settings and add your custom schema to "Exposed schemas".
- Run the following SQL, substituting
myschema
with your schema name:
_10GRANT USAGE ON SCHEMA myschema TO anon, authenticated, service_role;_10GRANT ALL ON ALL TABLES IN SCHEMA myschema TO anon, authenticated, service_role;_10GRANT ALL ON ALL ROUTINES IN SCHEMA myschema TO anon, authenticated, service_role;_10GRANT ALL ON ALL SEQUENCES IN SCHEMA myschema TO anon, authenticated, service_role;_10ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON TABLES TO anon, authenticated, service_role;_10ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON ROUTINES TO anon, authenticated, service_role;_10ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA myschema GRANT ALL ON SEQUENCES TO anon, authenticated, service_role;
Now you can access these schemas from data APIs: