CREATE ROLE lotusadmin WITH LOGIN;

CREATE ROLE lotusdata WITH LOGIN;

CREATE ROLE lotusreader WITH LOGIN;

GRANT ALL PRIVILEGES ON DATABASE lotus TO lotusadmin;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO lotusadmin;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO lotusadmin;
GRANT USAGE ON SCHEMA public to lotusadmin;

ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON tables TO lotusdata;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON tables TO lotusreader;

GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO lotusdata;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO lotusreader;
