Save branches in lower groups
This commit is contained in:
parent
201e7a3176
commit
2c23c413ef
|
@ -4,18 +4,20 @@ namespace :build do
|
||||||
require 'travis'
|
require 'travis'
|
||||||
Travis::Database.connect
|
Travis::Database.connect
|
||||||
|
|
||||||
|
|
||||||
|
Build.select(['id', 'commit_id']).pushes.includes(:commit).find_in_batches do |builds|
|
||||||
branches = Hash.new { |h, k| h[k] = [] }
|
branches = Hash.new { |h, k| h[k] = [] }
|
||||||
|
|
||||||
Build.pushes.includes(:commit).find_in_batches do |builds|
|
|
||||||
builds.each do |build|
|
builds.each do |build|
|
||||||
#next if build.branch
|
#next if build.branch
|
||||||
branches[build.commit.branch] << build.id
|
branches[build.commit.branch] << build.id
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
branches.each do |branch, ids|
|
branches.each do |branch, ids|
|
||||||
Build.where(id: ids).update_all(branch: branch)
|
Build.where(id: ids).update_all(branch: branch)
|
||||||
end
|
end
|
||||||
|
end; nil
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user