-- App user
CREATE ROLE app_user WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOREPLICATION CONNECTION LIMIT -1 PASSWORD 'password';

ALTER DEFAULT PRIVILEGES FOR ROLE superuser IN SCHEMA public GRANT ALL ON TABLES TO app_user;

ALTER DEFAULT PRIVILEGES FOR ROLE superuser IN SCHEMA public GRANT
SELECT
, USAGE ON SEQUENCES TO app_user;

-- Webhook user
CREATE ROLE webhook_user WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOREPLICATION CONNECTION LIMIT -1 PASSWORD 'password';

ALTER DEFAULT PRIVILEGES FOR ROLE superuser IN SCHEMA public GRANT ALL ON TABLES TO webhook_user;

ALTER DEFAULT PRIVILEGES FOR ROLE superuser IN SCHEMA public GRANT
SELECT
, USAGE ON SEQUENCES TO webhook_user;

-- No RLS user
CREATE ROLE no_rls_user WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOREPLICATION CONNECTION LIMIT -1 PASSWORD 'password';

ALTER DEFAULT PRIVILEGES FOR ROLE superuser IN SCHEMA public GRANT ALL ON TABLES TO no_rls_user;

ALTER DEFAULT PRIVILEGES FOR ROLE superuser IN SCHEMA public GRANT
SELECT
, USAGE ON SEQUENCES TO no_rls_user;

