rake 任务的一些修改

This commit is contained in:
huang 2018-06-12 16:51:59 +08:00
parent 436d488d72
commit c0f1e355ec
1 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,9 @@ namespace :gitlab do
task :useless_user => :environment do
# projects = Project.where(:id => [6286, 6292, 6293, 6294])
users = User.find_by_sql("SELECT * FROM `users` where gid is not null group by gid having count(*)=2")
ids = User.find_by_sql("select gid from users where gid is not null group by gid having count(gid) > 1").map(&:gid)
users = User.where(:gid => ids)
g = Gitlab.client
# users = User.where(:gid => 8823)
users.each do |user|
puts "start"+ "#{user.id}"