# File lib/active_record/connection_adapters/abstract/schema_statements.rb, line 166 def add_index(table_name, column_name, options = {}) index_name = "#{table_name}_#{Array(column_name).first}_index" if Hash === options # legacy support, since this param was a string index_type = options[:unique] ? "UNIQUE" : "" index_name = options[:name] || index_name else index_type = options end execute "CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(", ")})" end