CREATE ROLE api LOGIN PASSWORD 'api-user';

GRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA "accounts" TO api;
GRANT USAGE ON SCHEMA "accounts" TO api;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA "accounts" TO api;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA accounts TO api;

GRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA "stats" TO api;
GRANT USAGE ON SCHEMA "stats" TO api;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA "stats" TO api;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA stats TO api;


