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: 20190111084034_change_database_encoding_to_utf8mb4.rb
    path of file: ./repos/alonetone/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class ChangeDatabaseEncodingToUtf8mb4 < ActiveRecord::Migration[5.2]
  def up
    change_encoding('utf8mb4')
  end

  def down
    change_encoding('utf8')
  end


    
  def change_encoding(encoding)
    execute <<~SQL
      ALTER DATABASE #{ActiveRecord::Base.connection.current_database}
      CHARACTER SET = #{encoding}
      COLLATE #{encoding}_unicode_ci
    SQL
    ActiveRecord::Base.connection.tables.each do |table_name|
      execute <<~SQL
        ALTER TABLE #{table_name}
        CONVERT TO CHARACTER SET #{encoding}
        COLLATE #{encoding}_unicode_ci
      SQL
    end
  end