argos/dmp-db-scema/updates/00.00.016_Insert_default_bl...

20 lines
4.5 KiB
SQL

DO $$DECLARE
this_version CONSTANT varchar := '00.00.016';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
INSERT INTO public."DMPProfile" VALUES ('86635178-36a6-484f-9057-a934e4eeecd5', 'Dmp Default Blueprint', '<root><sections><section id="f94e50e0-cb97-4c65-8b88-e5db6badd41d" label="Main Info" description="" ordinal="1" hasTemplates="false"><systemFields><systemField id="e62c3fa2-4cbe-41bf-a00e-ad722c7c7da1" type="0" label="Title of DMP" placeholder="Title of DMP" description="" required="true" ordinal="1"></systemField><systemField id="eed2871d-5201-401e-8453-87afbeac77e3" type="1" label="Description" placeholder="Fill with description" description="Briefly describe the context and purpose of the DMP" required="true" ordinal="2"></systemField><systemField id="41a0b1db-b186-467d-8edf-7d3b2456f95e" type="2" label="Researchers" placeholder="Select researchers" description="Add here the names of people that have produced, processed, analysed the data described in the DMP." required="false" ordinal="3"></systemField><systemField id="0f0afb55-a11b-41db-a4d0-67ebb74d8685" type="3" label="Organizations" placeholder="Select organization" description="Add here the names of the organizations contributing to the creation and revision of the DMPs" required="false" ordinal="4"></systemField><systemField id="db493026-3130-4730-9b93-da6b77d2eea4" type="4" label="Language" placeholder="Language" description="Select the language of your DMP" required="true" ordinal="5"></systemField><systemField id="22deb104-1c46-4ea8-8261-8fdc9500dca2" type="5" label="Contact" placeholder="Contact" description="" required="true" ordinal="6"></systemField></systemFields><descriptionTemplates></descriptionTemplates></section><section id="3c2608e5-9320-4d94-9ed7-1eab9500d84b" label="Funding" description="" ordinal="2" hasTemplates="false"><systemFields><systemField id="527af8fe-27b0-4715-9e1e-35a2fce834a1" type="6" label="Funding organizations" placeholder="Funder" description="Select a funder of your research or add new" required="true" ordinal="1"></systemField><systemField id="4d12904e-2501-4d57-8d2b-1ac795c297e7" type="7" label="Grants" placeholder="Grant" description="Find the grant of your research or add new" required="true" ordinal="2"></systemField><systemField id="82f235c8-98fc-48d1-8245-36ab08f01036" type="8" label="Project" placeholder="Project" description="Projects in Argos are perceived as distinct activities falling under a grant or common activities under different grants in collaborative schemas, eg open call for contributions. Please complete it for the grant associated to your organization if your project falls under this category. In all other cases, please leave blank and it will be autocompleted." required="false" ordinal="3"></systemField></systemFields><descriptionTemplates></descriptionTemplates></section><section id="2a77e1f6-9989-4aeb-acd9-48e911a92abd" label="License" description="" ordinal="3" hasTemplates="false"><systemFields><systemField id="75c31705-6731-45dd-9853-75c5d0627439" type="9" label="License" placeholder="License" description="Assign a license to your DMP by selecting the most appropriate from the list." required="false" ordinal="1"></systemField><systemField id="990df932-eae6-44ca-85da-5378b010f439" type="10" label="Access Rights" placeholder="Access Rights" description="Choose how the DMP is displayed after is published on Zenodo. By choosing Open Access, the DMP will be open on Zenodo after the Publication Date. By choosing Restricted Access, the DMP will be restricted after the publication is made." required="false" ordinal="2"></systemField></systemFields><descriptionTemplates></descriptionTemplates></section><section id="0db7845b-0e7c-41df-8d91-cbca97995fd5" label="Templates" description="" ordinal="4" hasTemplates="true"><systemFields></systemFields><descriptionTemplates></descriptionTemplates></section></sections></root>',1, now(),now());
UPDATE public."DMP" SET "Profile" = '86635178-36a6-484f-9057-a934e4eeecd5' WHERE "Profile" IS NULL;
UPDATE public."Dataset" SET "DmpSectionIndex" = '3' WHERE "DmpSectionIndex" IS NULL;
UPDATE public."DMPDatasetProfile" SET "data" = '{"dmpSectionIndex":[3]}' WHERE "data" IS NULL;
ALTER TABLE public."Dataset"
ALTER COLUMN "DmpSectionIndex" SET NOT NULL;
ALTER TABLE public."DMPDatasetProfile"
ALTER COLUMN "data" SET NOT NULL;
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.016', '2023-09-12 12:00:00.000000+02', now(), 'Insert default blueprint, update profile of existing dmps and update DmpSectionIndex for each dataset.');
END$$;