rails/rails — pull request #3351 by vjebelev (2011-10-17 17:36:53+00:00)
Title: AR changes to support creating ordered (asc, desc) indexes

Allows to have AR migrations that create indexes with specified per-column order (asc, desc) for some extra performance fine-tuning, e.g. http://stackoverflow.com/questions/743858/sql-server-indexes-ascending-or-descending-what-difference-does-it-make . Supported by most SQL databases.

add_index(:accounts, [:branch_id, :party_id], :order => {:branch_id => :desc, :part_id => :asc})

generates

CREATE INDEX by_branch_desc_party ON accounts(branch_id DESC, party_id ASC)