GRANT CONNECT ON DATABASE mesavault_ucepsa_hot TO grafana_ucepsa_ro;

GRANT USAGE ON SCHEMA mv_hot TO grafana_ucepsa_ro;
GRANT USAGE ON SCHEMA mv_reports_ucepsa_demo TO grafana_ucepsa_ro;
GRANT USAGE ON SCHEMA mv_edge_oee_ucepsa_demo TO grafana_ucepsa_ro;
GRANT USAGE ON SCHEMA mv_core TO grafana_ucepsa_ro;

GRANT SELECT ON ALL TABLES IN SCHEMA mv_hot TO grafana_ucepsa_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA mv_reports_ucepsa_demo TO grafana_ucepsa_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA mv_edge_oee_ucepsa_demo TO grafana_ucepsa_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA mv_core TO grafana_ucepsa_ro;

GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA mv_reports_ucepsa_demo TO grafana_ucepsa_ro;

ALTER DEFAULT PRIVILEGES IN SCHEMA mv_hot
GRANT SELECT ON TABLES TO grafana_ucepsa_ro;

ALTER DEFAULT PRIVILEGES IN SCHEMA mv_reports_ucepsa_demo
GRANT SELECT ON TABLES TO grafana_ucepsa_ro;

ALTER DEFAULT PRIVILEGES IN SCHEMA mv_edge_oee_ucepsa_demo
GRANT SELECT ON TABLES TO grafana_ucepsa_ro;

ALTER DEFAULT PRIVILEGES IN SCHEMA mv_reports_ucepsa_demo
GRANT EXECUTE ON FUNCTIONS TO grafana_ucepsa_ro;
