GRANT USAGE ON SCHEMA dh TO PUBLIC;

ALTER DEFAULT PRIVILEGES IN SCHEMA dh GRANT SELECT ON TABLES TO xdb_viewer;
ALTER DEFAULT PRIVILEGES IN SCHEMA dh GRANT SELECT, UPDATE, INSERT ON TABLES TO xdb_logger;
ALTER DEFAULT PRIVILEGES IN SCHEMA dh GRANT ALL ON TABLES TO xdb_admin;

ALTER TABLE dh.metadata OWNER TO xdb_admin;
GRANT SELECT ON TABLE dh.metadata TO xdb_viewer;
GRANT SELECT ON TABLE dh.metadata TO xdb_logger;

GRANT SELECT ON ALL TABLES IN SCHEMA dh TO xdb_viewer;
GRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA dh TO xdb_logger;
GRANT ALL ON ALL TABLES IN SCHEMA dh TO xdb_admin;