Skip to content

Commit 4a3bb8b

Browse files
authored
fixed issue with is_other -> Org upgrade task (#2613)
1 parent 8c38933 commit 4a3bb8b

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

lib/tasks/upgrade.rake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -988,12 +988,15 @@ namespace :upgrade do
988988
desc "Attempts to migrate other_organisation entries to Orgs"
989989
task migrate_other_organisation_to_org: :environment do
990990
is_other = Org.find_by(is_other: true)
991-
p "No is_other Org defined, so no orgs need to be created!" unless is_other.present?
992-
return false unless is_other.present?
991+
users = is_other.present? ? User.where(org: is_other) : []
992+
993+
if is_other.present?
994+
p "Processing #{users.length} users attached to '#{is_other.name}' #{is_other.id}"
995+
p "this may take more than 15 minutes depending on how many users are in your database"
996+
else
997+
p "No is_other Org defined, so no orgs need to be created!"
998+
end
993999

994-
users = User.where(org: is_other)
995-
p "Processing #{users.length} users attached to '#{is_other.name}' #{is_other.id}"
996-
p "this may take more than 15 minutes depending on how many users are in your database"
9971000
# Unfortunately can't use the Parallel gem here because we can have collisions
9981001
# when creating Orgs
9991002
users.each do |user|

0 commit comments

Comments
 (0)