You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20140221060607_add_user_snps_count.rb
    path of file: ./repos/snpr/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class AddUserSnpsCount < ActiveRecord::Migration
  def up
    add_column :snps, :user_snps_count, :integer
    Snp.reset_column_information
    user_snp_counts = execute(
      'select snp_name, count(*) as count from user_snps group by snp_name'
    ).to_a.re
    
  def up
    add_column :snps, :user_snps_count, :integer
    Snp.reset_column_information
    user_snp_counts = execute(
      'select snp_name, count(*) as count from user_snps group by snp_name'
    ).to_a.reduce({}) {|m,us| m[us['snp_name']] = us['count']; m }
    Snp.find_each do |s|
      s.user_snps_count = user_snp_counts[s.name]
      s.save!
    end
  end