Updating db script 00.01.058, adding 00.01.059

This commit is contained in:
Thomas Georgios Giannos 2024-03-07 13:34:56 +02:00
parent bb6037afba
commit fa97c55862
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,32 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.01.058';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE IF NOT EXISTS public."ant_UserContactInfo"
(
"id" uuid NOT NULL,
"user" uuid NOT NULL,
"ordinal" integer NOT NULL DEFAULT 0,
"type" smallint NOT NULL,
"value" character varying(512) 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 DEFAULT 1,
"tenant" uuid,
CONSTRAINT "ant_UserContactInfo_pkey" PRIMARY KEY (id),
CONSTRAINT "ant_UserContactInfo_tenant_fkey" FOREIGN KEY ("tenant")
REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "ant_UserContactInfo_user_fkey" FOREIGN KEY ("user")
REFERENCES public."ant_User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.058', '2024-02-28 12:00:00.000000+02', now(), 'Add table ant_UserContactInfo.');
END$$;

View File

@ -0,0 +1,29 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.01.059';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
ALTER TABLE public."ant_Annotation" ADD COLUMN "subject_id" uuid NOT NULL;
ALTER TABLE public."ant_Annotation" ADD COLUMN "thread_id" uuid;
ALTER TABLE public."ant_Annotation" ADD COLUMN "parent_id" uuid;
ALTER TABLE public."ant_Annotation" ADD COLUMN "protection_type" smallint NOT NULL;
ALTER TABLE public."ant_Annotation" ADD COLUMN "time_stamp" timestamp without time zone NOT NULL;
ALTER TABLE public."ant_Annotation" ADD CONSTRAINT "ant_Annotation_user_fkey" FOREIGN KEY ("subject_id")
REFERENCES public."ant_User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION;
ALTER TABLE public."ant_Annotation" ADD CONSTRAINT "ant_Annotation_parent_fkey" FOREIGN KEY ("parent_id")
REFERENCES public."ant_Annotation" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION;
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.059', '2024-03-07 12:00:00.000000+02', now(), 'Add columns on ant_Annotaion table.');
END$$;