From fa97c55862dbe9becd2645fda106c26590a71e55 Mon Sep 17 00:00:00 2001 From: Thomas Georgios Giannos Date: Thu, 7 Mar 2024 13:34:56 +0200 Subject: [PATCH] Updating db script 00.01.058, adding 00.01.059 --- ...0.01.058_Add_ant_UserContactInfo_table.sql | 32 +++++++++++++++++++ ...59_Update_ant_Annotation_table_columns.sql | 29 +++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql create mode 100644 dmp-db-scema/updates/00.01.059_Update_ant_Annotation_table_columns.sql diff --git a/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql b/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql new file mode 100644 index 000000000..9faa4404d --- /dev/null +++ b/dmp-db-scema/updates/00.01.058_Add_ant_UserContactInfo_table.sql @@ -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$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.059_Update_ant_Annotation_table_columns.sql b/dmp-db-scema/updates/00.01.059_Update_ant_Annotation_table_columns.sql new file mode 100644 index 000000000..8c54a65dc --- /dev/null +++ b/dmp-db-scema/updates/00.01.059_Update_ant_Annotation_table_columns.sql @@ -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$$; \ No newline at end of file