From ae08a6ff346e72c372a4d60d2238b92673bc193a Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Mon, 25 Mar 2019 10:56:59 -0400 Subject: [PATCH] renamed the FLyway migration script, to reflect the 4-digit version number scheme we (seem to have) agreed to use. also cleaned up synchronized the migration rules with the ones used for real time sanitizing of the folder paths in zip uploads. (#5565) --- ...l => V4.11.0.1__5565-sanitize-directory-labels.sql} | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename src/main/resources/db/migration/{V4.11.1__5565-sanitize-directory-labels.sql => V4.11.0.1__5565-sanitize-directory-labels.sql} (59%) 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, '[/ \.\-]+$', '', '');