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: 20140813110107_set_charset_for_mysql.rb
    path of file: ./repos/huginn/db/migrate
    
    the code of the file until where you have to start completion: class SetCharsetForMysql < ActiveRecord::Migration[4.2]
  def all_models
    @all_models ||= [
      Agent,
      AgentLog,
      Event,
      Link,
      Scenario,
      ScenarioMembership,
      User,
      UserCredential,
      Delayed::Job,
    ]
  end

  def change
    # This is migration is for MySQL only.
    return unless mysql?

    reversible do |dir|
      dir.up do
        all_models.each { |model|
          table_name = model.table_name

          next 
    
  def change
    # This is migration is for MySQL only.
    return unless mysql?

    reversible do |dir|
      dir.up do
        all_models.each { |model|
          table_name = model.table_name

          next unless connection.table_exists? table_name

          model.columns.each { |column|
            name = column.name
            type = column.type
            limit = column.limit
            options = {
              limit:,
              null: column.null,
              default: column.default,
            }

            case type
            when :string, :text
              options.update(charset: 'utf8', collation: 'utf8_unicode_ci')
              case name
              when 'username'
                options.update(limit: 767 / 4, charset: 'utf8mb4', collation: 'utf8mb4_unicode_ci')
              when 'message', 'options', 'name', 'memory',
                   'handler', 'last_error', 'payload', 'description'
                options.update(charset: 'utf8mb4', collation: 'utf8mb4_bin')
              when 'type', 'schedule', 'mode', 'email',
                   'invitation_code', 'reset_password_token'
                options.update(collation: 'utf8_bin')
              when 'guid', 'encrypted_password'
                options.update(charset: 'ascii', collation: 'ascii_bin')
              end
            else
              next
            end

            change_column table_name, name, type, **options
          }

          execute 'ALTER TABLE %s CHARACTER SET utf8 COLLATE utf8_unicode_ci' % table_name
        }

        execute 'ALTER DATABASE `%s` CHARACTER SET utf8 COLLATE utf8_unicode_ci' % connection.current_database
      end