Skip to content

Commit

Permalink
renamed the FLyway migration script, to reflect the 4-digit version n…
Browse files Browse the repository at this point in the history
…umber 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)
  • Loading branch information
landreev committed Mar 25, 2019
1 parent c6965ac commit ae08a6f
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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, '[/ \.\-]+$', '', '');

0 comments on commit ae08a6f

Please sign in to comment.