fix: transfer repository user id

This commit is contained in:
2021-08-27 10:54:20 +08:00
parent cf8278ee5e
commit c9e265f95c
2 changed files with 17 additions and 1 deletions

View File

@@ -42,4 +42,20 @@ namespace :fix_some_error_data do
puts "======Count: #{team_count}======"
puts "======End: fix open full team authorize======"
end
task transfer_repository_user_id: :environment do
puts "======Begin: fix open full team authorize======"
repo_count = 0
AppliedTransferProject.find_each do |transfer|
next unless transfer.project.present?
next unless transfer.project.repository.present?
if transfer.project.user_id != transfer.project.repository.user_id
transfer.project.repository.update(user_id: transfer.project.user_id)
repo_count += 1
end
end
puts "======Count: #{repo_count}======"
puts "======End: fix open full team authorize======"
end
end