14 lines
581 B
SQL
14 lines
581 B
SQL
DO $$DECLARE
|
|
this_version CONSTANT varchar := '00.00.011';
|
|
BEGIN
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
INSERT INTO public."EntityDoi" ("ID", "EntityType", "RepositoryId", "Doi", "CreatedAt", "UpdatedAt", "EntityId")
|
|
SELECT uuid_generate_v4(), 'DMP', 'Zenodo', public."DMP"."DOI", now(), now(), public."DMP"."ID"
|
|
FROM public."DMP"
|
|
WHERE public."DMP"."DOI" IS NOT NULL;
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.011', '2022-10-27 10:50:00.000000+02', now(), 'Migrate DMP.DOI to EntityDoi table');
|
|
|
|
END$$; |