argos/dmp-db-scema/updates/00.01.012_Add_Dmp_descripti...

23 lines
881 B
SQL

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_group" uuid NOT NULL,
"section_id" uuid NOT NULL,
"created_at" timestamp without time zone NOT NULL DEFAULT now(),
"updated_at" timestamp without time zone NOT NULL DEFAULT now(),
"is_active" smallint NOT NULL DEFAULT 1,
CONSTRAINT "DmpDescriptionTemplate_pkey" PRIMARY KEY (id),
CONSTRAINT "DmpDescriptionTemplate_dmp_fkey" FOREIGN KEY (dmp)
REFERENCES public."Dmp" (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$$;