AR changes to support creating ordered (asc, desc) indexes #3529

Merged
merged 1 commit into from Nov 5, 2011

Projects

None yet

2 participants

@vjebelev

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)

(this is to replace pull request 3351)

@jonleighton jonleighton merged commit 2751e21 into rails:master Nov 5, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment