cessda / cessda.cvs.two

Apache License 2.0
0 stars 2 forks source link

Regenerate citations and update version numbers inside #555

Closed MajaDolinar closed 1 year ago

MajaDolinar commented 1 year ago

Citations currently do not display the proper version number. See image for details Citations_issue

Stifo commented 1 year ago

@john-shepherdson @Joshua-cessda-admin

The following SQL script updates version numbers in citation texts for all the published versions since the 3-digit migration. It should be executed over the DB.

The script relies on MySQL's regexp_replace function available from v8.0+.

use cvs;

SET @SQL_SAFE_UPDATES=@@SQL_SAFE_UPDATES;
SET SQL_SAFE_UPDATES=0;

SET @min_id = (select min(id) from version where regexp_like(version_notes, '(?mi)^.*?To align with a new versioning system.+$'));

update
    version
set
    citation = regexp_replace(
        regexp_replace(
            citation,
            'Version[:blank:]+([0-9]+\.[0-9]+(\.[0-9]+)?)',
            concat('Version ', number)
        ),
        '(urn:.+?)([0-9]+\.[0-9]+(\.[0-9]+)?)',
        concat('$1', number)
    )
where
    status = 'PUBLISHED'
    and
    id >= @min_id;
;

SET SQL_SAFE_UPDATES=@SQL_SAFE_UPDATES;
MajaDolinar commented 1 year ago

Have you executed this code on staging? It still does not correspond to version selected. Available from changes accordingly, whereas the Citation information does not change. Screenshot 2023-04-03 at 10 12 07

john-shepherdson commented 1 year ago

@matthew-morris-cessda can you take a look in Joshua's absence?

MajaDolinar commented 1 year ago

@matthew-morris-cessda and @john-shepherdson what is happening then with this part? I cannot close it and sign it for relelase if it is not done.

matthew-morris-cessda commented 1 year ago

@MajaDolinar I have run the script against CVS Staging, see attached screenshot

image

MajaDolinar commented 1 year ago

Thank you @matthew-morris-cessda I see the issue is resolved, so I am closing this issue. Ready for 3.1.0 release.