Adjustreact
daiao 5 years ago
parent 873a750b67
commit d1bf5365f6

@ -3,7 +3,7 @@ class AddIndexToUserIdAndShixunIdForShixuns < ActiveRecord::Migration[5.2]
shixun_members = ShixunMember.select("count(*) cnt, shixun_members.*").group(:user_id, :shixun_id).having("cnt > 1") shixun_members = ShixunMember.select("count(*) cnt, shixun_members.*").group(:user_id, :shixun_id).having("cnt > 1")
puts "shixun_members: #{shixun_members.map{|sm| sm.id}}" puts "shixun_members: #{shixun_members.map{|sm| sm.id}}"
shixun_members.each do |sm| shixun_members.each do |sm|
s = ShixunModify.where.not(id: sm.id).where(user_id: sm.user_id, shixun_id: sm.shixun_id) s = ShixunMember.where.not(id: sm.id).where(user_id: sm.user_id, shixun_id: sm.shixun_id)
puts "s: #{s.map{|sm| sm.id}}" puts "s: #{s.map{|sm| sm.id}}"
end end

Loading…
Cancel
Save