From 281475bb85fd715850250483a304c55bfaf73a0f Mon Sep 17 00:00:00 2001 From: Thomas Georgios Giannos Date: Thu, 2 Nov 2023 17:11:34 +0200 Subject: [PATCH] Adding sql script for new DmpDescriptionTemplate table --- ...012_Add_Dmp_description_template_table.sql | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dmp-db-scema/updates/00.01.012_Add_Dmp_description_template_table.sql diff --git a/dmp-db-scema/updates/00.01.012_Add_Dmp_description_template_table.sql b/dmp-db-scema/updates/00.01.012_Add_Dmp_description_template_table.sql new file mode 100644 index 000000000..e3fca8b5f --- /dev/null +++ b/dmp-db-scema/updates/00.01.012_Add_Dmp_description_template_table.sql @@ -0,0 +1,22 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.012'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + +CREATE TABLE IF NOT EXISTS public."DmpDescriptionTemplate" +( + "id" uuid NOT NULL, + "dmp" uuid NOT NULL, + "description_template" uuid NOT NULL, + "data" text COLLATE pg_catalog."default" NOT NULL, + CONSTRAINT id PRIMARY KEY (id), + CONSTRAINT "DmpDescriptionTemplate_dmp_fkey" FOREIGN KEY (dmp) + REFERENCES public."Dmp" (id), + CONSTRAINT "DmpDescriptionTemplate_description_template_fkey" FOREIGN KEY (description_template) + REFERENCES public."DescriptionTemplate" (id) +) + +INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.012', '2023-11-02 12:00:00.000000+02', now(), 'Add Dmp Description Template table (former DMPDatasetProfile).'); + +END$$; \ No newline at end of file