-- Database: <TEST_DB_NAME>

-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;

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

ALTER DEFAULT PRIVILEGES FOR ROLE <OWNER>
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
ALTER DEFAULT PRIVILEGES FOR ROLE <OWNER>
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;

ALTER DEFAULT PRIVILEGES FOR ROLE <OWNER>
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;

ALTER DEFAULT PRIVILEGES FOR ROLE <OWNER>
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;

ALTER DEFAULT PRIVILEGES FOR ROLE <OWNER>
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
