diff --git a/src/main/resources/db/migration/V4.11.1__5565-sanitize-directory-labels.sql b/src/main/resources/db/migration/V4.11.0.1__5565-sanitize-directory-labels.sql similarity index 59% rename from src/main/resources/db/migration/V4.11.1__5565-sanitize-directory-labels.sql rename to src/main/resources/db/migration/V4.11.0.1__5565-sanitize-directory-labels.sql index ac54f965804..3d3ed777c9f 100644 --- a/src/main/resources/db/migration/V4.11.1__5565-sanitize-directory-labels.sql +++ b/src/main/resources/db/migration/V4.11.0.1__5565-sanitize-directory-labels.sql @@ -1,11 +1,9 @@ -- replace any sequences of slashes and backslashes with a single slash: UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '[/\\][/\\]+', '/', 'g'); --- replace any ampersands with ' and ': -UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '&', ' and ', 'g'); --- strip (and replace with a whitespace) any characters that are no longer allowed in the directory labels: -UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '[^A-Za-z0-9_ ./-]+', ' ', 'g'); --- now replace any sequences of whitespaces with a single white space: -UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, ' +', ' ', 'g'); +-- strip (and replace with a .) any characters that are no longer allowed in the directory labels: +UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '\.\.+', '.', 'g'); +-- now replace any sequences of .s with a single .: +UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '\.\.+', '.', 'g'); -- get rid of any leading or trailing slashes, spaces, '-'s and '.'s: UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '^[/ .\-]+', '', ''); UPDATE filemetadata SET directoryLabel = regexp_replace(directoryLabel, '[/ \.\-]+$', '', '');