2019-06-07 15:55:10 +02:00
|
|
|
INSERT INTO public."UserDMP"(
|
|
|
|
usr, dmp, role)
|
|
|
|
SELECT "Creator", "ID", 0
|
2020-04-29 13:03:19 +02:00
|
|
|
FROM public."DMP";
|
2019-06-07 15:55:10 +02:00
|
|
|
|
|
|
|
DELETE
|
|
|
|
FROM public."UserDMP" as us1
|
|
|
|
using public."UserDMP" as us2
|
2020-04-29 13:03:19 +02:00
|
|
|
where us1."id" < us2."id" AND us1."dmp" = us2."dmp";
|
2019-06-07 15:55:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public."DMPDatasetProfile"
|
|
|
|
(
|
|
|
|
"ID" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
|
|
dmp uuid NOT NULL,
|
|
|
|
datasetprofile uuid NOT NULL,
|
|
|
|
CONSTRAINT "DMPDatasetProfile_pkey" PRIMARY KEY ("ID"),
|
|
|
|
CONSTRAINT "DMPDatasetProfile_datasetprofile_fkey" FOREIGN KEY (datasetprofile)
|
|
|
|
REFERENCES public."DatasetProfile" ("ID") MATCH SIMPLE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION,
|
|
|
|
CONSTRAINT "DMPDatasetProfile_dmp_fkey" FOREIGN KEY (dmp)
|
|
|
|
REFERENCES public."DMP" ("ID") MATCH SIMPLE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
)
|
|
|
|
WITH (
|
|
|
|
OIDS = FALSE
|
|
|
|
)
|
|
|
|
TABLESPACE pg_default;
|
|
|
|
|
|
|
|
ALTER TABLE public."DMPDatasetProfile"
|
2020-04-29 13:03:19 +02:00
|
|
|
-- OWNER to dmtadm;
|
2020-05-12 12:10:23 +02:00
|
|
|
OWNER to :POSTGRES_USER;
|
2019-06-07 15:55:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE public."UserDMP"
|
2020-04-29 13:03:19 +02:00
|
|
|
-- OWNER to dmtadm;
|
2020-05-12 12:10:23 +02:00
|
|
|
OWNER to :POSTGRES_USER;
|
2019-06-07 15:55:10 +02:00
|
|
|
|
|
|
|
|
2020-04-29 13:03:19 +02:00
|
|
|
--INSERT INTO public."DMPDatasetProfile"(
|
|
|
|
-- dmp, datasetprofile)
|
|
|
|
-- SELECT "ID", unnest(xpath('/profiles/profile/@profileId', dmpp."AssociatedDmps"::xml)::text[]::UUID[])
|
|
|
|
-- FROM public."DMP" as dmpp;
|
2019-06-07 15:55:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-29 13:03:19 +02:00
|
|
|
ALTER TABLE public."DMP"
|
|
|
|
ADD "FinalizedDat" timestamp(6) WITH time zone;
|
2019-06-07 15:55:10 +02:00
|
|
|
|
2020-04-29 13:03:19 +02:00
|
|
|
UPDATE public."DMP" SET "FinalizedDat" = "Modified"
|
|
|
|
WHERE "Status" = 1;
|
2019-06-07 15:55:10 +02:00
|
|
|
|
|
|
|
|
2020-04-29 13:03:19 +02:00
|
|
|
ALTER TABLE public."Dataset"
|
|
|
|
ADD "FinalizedDat" timestamp(6) WITH time zone;
|
2019-06-07 15:55:10 +02:00
|
|
|
|
2020-04-29 13:03:19 +02:00
|
|
|
UPDATE public."Dataset" SET "FinalizedDat" = "Modified"
|
|
|
|
WHERE "Status" = 1;
|