Ver Fonte

Sort schema columns by name

Andrew Kane há 8 anos atrás
pai
commit
9011a141f3
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      lib/blazer/adapters/sql_adapter.rb

+ 1 - 1
lib/blazer/adapters/sql_adapter.rb

@@ -47,7 +47,7 @@ module Blazer
 
       def schema
         result = data_source.run_statement(connection_model.send(:sanitize_sql_array, ["SELECT table_schema, table_name, column_name, data_type, ordinal_position FROM information_schema.columns WHERE table_schema IN (?) ORDER BY 1, 2", schemas]))
-        result.rows.group_by { |r| [r[0], r[1]] }.map { |k, vs| {schema: k[0], table: k[1], columns: vs.sort_by { |v| v[4].to_i }.map { |v| {name: v[2], data_type: v[3]} }} }
+        result.rows.group_by { |r| [r[0], r[1]] }.map { |k, vs| {schema: k[0], table: k[1], columns: vs.sort_by { |v| v[2] }.map { |v| {name: v[2], data_type: v[3]} }} }
       end
 
       def preview_statement