indexes(table, stream) private

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/schema_dumper.rb, line 177
      def indexes(table, stream)
        if (indexes = @connection.indexes(table)).any?
          add_index_statements = indexes.map do |index|
            statement_parts = [ ('add_index ' + index.table.inspect) ]
            statement_parts << index.columns.inspect
            statement_parts << (':name => ' + index.name.inspect)
            statement_parts << ':unique => true' if index.unique

            index_lengths = index.lengths.compact if index.lengths.is_a?(Array)
            statement_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) if index_lengths.present?

            '  ' + statement_parts.join(', ')
          end

          stream.puts add_index_statements.sort.join("\n")
          stream.puts
        end
      end
Register or log in to add new notes.