<commit_before>module SchemaPlusIndex
  module Middleware
    module Migration

      def self.insert
        SchemaMonkey::Middleware::Migration::Column.prepend Shortcuts
        SchemaMonkey::Middleware::Migration::Index.prepend NormalizeArgs
        SchemaMonkey::Middleware::Migration::Index.prepend IgnoreDuplicates
      end

      class Shortcuts < SchemaMonkey::Middleware::Base
        def call(env)
          case env.options[:index]
          when true then env.options[:index] = {}
          when :unique then env.options[:index] = { :unique => true }
          end
          continue env
        end
      end<commit_msg>migration.add_column and change_table.add_column should respect :index option<commit_after>module SchemaPlusIndex
  module Middleware
    module Migration

      def self.insert
        SchemaMonkey::Middleware::Migration::Column.prepend Shortcuts
        SchemaMonkey::Middleware::Migration::Column.append IndexOnAddColumn
        SchemaMonkey::Middleware::Migration::Index.prepend NormalizeArgs
        SchemaMonkey::Middleware::Migration::Index.prepend IgnoreDuplicates
      end

      class Shortcuts < SchemaMonkey::Middleware::Base
        def call(env)
          case env.options[:index]
          when true then env.options[:index] = {}
          when :unique then env.options[:index] = { :unique => true }
          end
          continue env
        end
      end

      class IndexOnAddColumn < SchemaMonkey::Middleware::Base
        def call(env)
          continue env
          return unless env.options[:index]

          case env.operation
          when :add, :record
            env.caller.add_index(env.table_name, env.column_name, env.options[:index])
          end
        end
      end
{'fraction_non_alphanumeric': 0.08323765786452354, 'fraction_numerical': 0.0, 'mean_word_length': 2.593814432989691, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6430279', 'n_tokens_mistral': 448, 'n_tokens_neox': 452, 'n_words': 102}