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: 20150501152228_rename_total_votes_to_voters.rb
    path of file: ./repos/discourse/plugins/poll/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class RenameTotalVotesToVoters < ActiveRecord::Migration[4.2]
  def up
    PostCustomField
      .where(name: "polls")
      .find_each do |pcf|
        polls = ::JSON.parse(pcf.value)
        polls.each_value do |poll|
          next if poll.has_key?("voters")
   
    
  def up
    PostCustomField
      .where(name: "polls")
      .find_each do |pcf|
        polls = ::JSON.parse(pcf.value)
        polls.each_value do |poll|
          next if poll.has_key?("voters")
          poll["voters"] = poll["total_votes"]
          poll.delete("total_votes")
        end
        pcf.value = polls.to_json
        pcf.save
      end
  end