Commit 18cd39ad by Alex Chaffee

Merge pull request #79 from phallstrom/master

One line patch to sort the indexes by name.
parents ff1131da b438a770
...@@ -101,7 +101,7 @@ module AnnotateModels ...@@ -101,7 +101,7 @@ module AnnotateModels
return "" if indexes.empty? return "" if indexes.empty?
max_size = indexes.collect{|index| index.name.size}.max + 1 max_size = indexes.collect{|index| index.name.size}.max + 1
indexes.each do |index| indexes.sort_by{|index| index.name}.each do |index|
index_info << sprintf("# %-#{max_size}.#{max_size}s %s %s", index.name, "(#{index.columns.join(",")})", index.unique ? "UNIQUE" : "").rstrip + "\n" index_info << sprintf("# %-#{max_size}.#{max_size}s %s %s", index.name, "(#{index.columns.join(",")})", index.unique ? "UNIQUE" : "").rstrip + "\n"
end end
return index_info return index_info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment