add reference, referenceType, SupportiveMaterial

This commit is contained in:
amentis 2023-11-22 10:29:29 +02:00
parent db6cb44ff8
commit c19920afb2
1 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,66 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.01.000';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE public."Reference"
(
id uuid NOT NULL,
label character varying(250) COLLATE pg_catalog."default" NOT NULL,
description text COLLATE pg_catalog."default",
abbreviation character varying(50) COLLATE pg_catalog."default",
source character varying(1024) COLLATE pg_catalog."default",
is_active smallint NOT NULL,
created_by uuid,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
type smallint NOT NULL,
definition character varying COLLATE pg_catalog."default",
reference character varying(1024) COLLATE pg_catalog."default" NOT NULL,
source_type smallint NOT NULL,
CONSTRAINT "Reference_pkey" PRIMARY KEY (id),
CONSTRAINT "Reference_created_by_fkey" FOREIGN KEY (created_by)
REFERENCES public."UserInfo" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
)
WITH (
OIDS = FALSE
);
CREATE TABLE public."ReferenceType"
(
id uuid NOT NULL,
name character varying(250) COLLATE pg_catalog."default" NOT NULL,
code character varying(100) COLLATE pg_catalog."default" NOT NULL,
definition character varying COLLATE pg_catalog."default" NOT NULL,
is_active smallint NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
CONSTRAINT "ReferenceType_pkey" PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
);
CREATE TABLE public."SupportiveMaterial"
(
id uuid NOT NULL,
type smallint NOT NULL,
language_code character varying(20) COLLATE pg_catalog."default" NOT NULL,
payload character varying COLLATE pg_catalog."default" NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
is_active smallint NOT NULL,
CONSTRAINT "SupportiveMaterial_pkey" PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.000', '2023-11-22 12:00:00.000000+02', now(), 'Add Reference, ReferenceType, SupportiveMaterial');
END$$;