Skip to content

Commit 0b887ec

Browse files
committed
Check ORCID prefix present in migration to avoid unnecessary updates
1 parent dec354a commit 0b887ec

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

db/migrate/20251128160923_update_orcids_in_profiles.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class UpdateOrcidsInProfiles < ActiveRecord::Migration[7.2]
22
ORCID_PREFIX = 'https://orcid.org/'.freeze
33
def up
44
Profile.where('orcid IS NOT NULL').find_each do |profile|
5-
profile.update_column(:orcid, profile.orcid.gsub(ORCID_PREFIX, ''))
5+
profile.update_column(:orcid, profile.orcid.gsub(ORCID_PREFIX, '')) if profile.orcid.start_with?(ORCID_PREFIX)
66
end
77
end
88

0 commit comments

Comments
 (0)