Flowdock
method

indexes

Importance_0
v3.0.5 - 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 417
      def indexes(table_name, name = nil)#:nodoc:
        indexes = []
        current_index = nil
        result = execute("SHOW KEYS FROM #{quote_table_name(table_name)}", name)
        result.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]
          indexes.last.lengths << row[7]
        end
        result.free
        indexes
      end
Register or log in to add new notes.