2023-10-27 16:05:48 +02:00
|
|
|
DO $$DECLARE
|
|
|
|
this_version CONSTANT varchar := '00.01.006';
|
|
|
|
BEGIN
|
|
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS public."DmpReference"
|
|
|
|
(
|
|
|
|
"id" uuid NOT NULL,
|
|
|
|
"dmp_id" uuid NOT NULL,
|
|
|
|
"reference_id" uuid NOT NULL,
|
|
|
|
"data" text COLLATE pg_catalog."default",
|
|
|
|
"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 "DmpReference_pkey" PRIMARY KEY (id),
|
|
|
|
CONSTRAINT "DmpReference_dmp_id_fkey" FOREIGN KEY ("dmp_id") REFERENCES public."Dmp"("id"),
|
|
|
|
CONSTRAINT "DmpReference_reference_id_fkey" FOREIGN KEY ("reference_id") REFERENCES public."Reference"("id")
|
2023-11-22 12:31:00 +01:00
|
|
|
);
|
2023-10-27 16:05:48 +02:00
|
|
|
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.006', '2023-10-27 12:00:00.000000+02', now(), 'Add DescriptionReference table.');
|
|
|
|
|
|
|
|
END$$;
|