Adding db infrastructure setup

This commit is contained in:
Janus Knudsen 2025-01-24 18:04:35 +01:00
parent 7dae58ec1e
commit 58bf4bea00
11 changed files with 125 additions and 6 deletions

View file

@ -0,0 +1,45 @@
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));