Flowdock
method

indexes

Importance_0
v2.1.0 - Show latest stable - 0 notes - Class: ActiveRecord::ConnectionAdapters::MysqlAdapter
indexes(table_name, name = nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 413
      def indexes(table_name, name = nil)#:nodoc:
        indexes = []
        current_index = nil
        execute("SHOW KEYS FROM #{quote_table_name(table_name)}", name).each do |row|
          if current_index != row[2]
            next if row[2] == "PRIMARY" # skip the primary key
            current_index = row[2]
            indexes << IndexDefinition.new(row[0], row[2], row[1] == "0", [])
          end

          indexes.last.columns << row[4]
        end
        indexes
      end
Register or log in to add new notes.