Skip to content

Commit 84c137e

Browse files
committed
Sorting by ordinal position makes sense, instead of by field creation date (default database order) also removed extraneous file
1 parent d940b83 commit 84c137e

File tree

2 files changed

+1
-771
lines changed

2 files changed

+1
-771
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,8 @@ def columns(table_name, name = nil)
373373
AND constraint_column_usage.column_name = columns.column_name
374374
)
375375
WHERE columns.TABLE_NAME = '#{table_name}'
376+
ORDER BY columns.ordinal_position
376377
}
377-
#Shawn Balestracci 2008-10-01 There's some debate in how the columns should be sorted. I am choosing to leave them unsorted as that was done in the
378-
#Rails 1.x adapter
379-
#add above the brace ORDER BY columns.ordinal_position
380-
#or ORDER BY columns.column_name
381-
#if you want them sorted differently.
382378

383379
result = select(sql, name, true)
384380
result.collect do |column_info|

0 commit comments

Comments
 (0)