-- Database: <TEST_DB_NAME>

-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;

CREATE DATABASE <TEST_DB_NAME>
    WITH
    OWNER = enterprisedb
    ENCODING = 'UTF8'
    LC_COLLATE = '<LC_COLLATE>'
    LC_CTYPE = '<LC_CTYPE>'
    LOCALE_PROVIDER = 'libc'
    TABLESPACE = pg_default
    CONNECTION LIMIT = -1
    IS_TEMPLATE = False;

ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;

ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;

ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;

ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
GRANT USAGE ON TYPES TO test_default_priv_user;
