X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d84737275793fcab0ac253c4abe734ad5e84ea12..b43cf1d3398b7004ada50e053ae235b814c9aa70:/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb diff --git a/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb b/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb index bec7ec7c4a..c28c26859f 100644 --- a/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb +++ b/services/api/db/migrate/20140117231056_normalize_collection_uuid.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class NormalizeCollectionUuid < ActiveRecord::Migration def count_orphans %w(head tail).each do |ht| @@ -25,7 +29,7 @@ EOS update_sql <<-EOS UPDATE collections SET uuid = regexp_replace(uuid,'\\+.*','') || '+' || length(manifest_text) - WHERE uuid !~ '^[0-9a-f]{32,}\\+[0-9]+' + WHERE uuid !~ '^[0-9a-f]{32,}\\+[0-9]+$' AND (regexp_replace(uuid,'\\+.*','') || '+' || length(manifest_text)) NOT IN (SELECT uuid FROM collections) EOS @@ -60,7 +64,7 @@ UPDATE links AND (#{ht}_kind='arvados#collection' or #{ht}_uuid ~ '^[0-9a-f]{32,}') AND #{ht}_uuid NOT IN (SELECT uuid FROM collections) AND regexp_replace(#{ht}_uuid,'\\+.*','') = regexp_replace(c.uuid,'\\+.*','') - AND c.uuid ~ '^[0-9a-f]{32,}\\+[0-9]+' + AND c.uuid ~ '^[0-9a-f]{32,}\\+[0-9]+$' EOS end