diff --git a/doc/release-notes/8599-legacy-templates b/doc/release-notes/8599-legacy-templates new file mode 100644 index 00000000000..7285a613635 --- /dev/null +++ b/doc/release-notes/8599-legacy-templates @@ -0,0 +1,5 @@ +Some older legacy templates did not have an associated termsofuseandaccess linked to them. When custom licenses were added, dataverses that these legacy templates as default would not allow the creation of a new dataset (500 error). + +In this release, we run a script that creates a default empty termsofuseandaccess for each of these templates and links them. + +Note the termsofuseandaccess that are created this way default to using the license with id=1 (cc0) and the fileaccessrequest to false. diff --git a/src/main/resources/db/migration/V5.10.1.3__8599-legacy-templates.sql b/src/main/resources/db/migration/V5.10.1.3__8599-legacy-templates.sql new file mode 100644 index 00000000000..5027c48df59 --- /dev/null +++ b/src/main/resources/db/migration/V5.10.1.3__8599-legacy-templates.sql @@ -0,0 +1,10 @@ +-- this script finds legacy templates that do not hava an associated termsofuseandaccess +-- and creates / links a termsofuseandaccess to them +with _update as +( +update template set termsofuseandaccess_id = nextval('termsofuseandaccess_id_seq' ) +where termsofuseandaccess_id is null +returning termsofuseandaccess_id +) +insert into termsofuseandaccess (id, fileaccessrequest, license_id) (select termsofuseandaccess_id, false, 1 from _update) +