CREATE ROLE sathumper WITH 
    CREATEROLE 
    CREATEDB
    LOGIN 
    PASSWORD '3911';

CREATE SCHEMA ptmain;
GRANT USAGE, CREATE ON SCHEMA ptmain TO sathumper;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA ptmain TO sathumper;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA ptmain TO sathumper;
ALTER DEFAULT PRIVILEGES IN SCHEMA ptmain
GRANT ALL PRIVILEGES ON TABLES TO sathumper;
 

-- prod.app_configuration definition

-- Drop table

-- DROP TABLE prod.app_configuration;

CREATE TABLE prod.app_configuration (

	id bigserial NOT NULL,

	"key" varchar(255) NOT NULL,

	value text NULL,

	"label" varchar(255) NULL,

	content_type varchar(255) DEFAULT 'text/plain'::character varying NULL,

	expires_at timestamptz NULL,

	created_at timestamptz DEFAULT CURRENT_TIMESTAMP NULL,

	modified_at timestamptz DEFAULT CURRENT_TIMESTAMP NULL,

	etag uuid DEFAULT gen_random_uuid() NULL,

	CONSTRAINT app_configuration_pkey PRIMARY KEY (id)

);

CREATE UNIQUE INDEX idx_prod_unique_key_label ON prod.app_configuration USING btree (key, COALESCE(label, ''::character varying));