Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

reducing funcalls, cleaning up primary key methods for sqlite adapter

  • Loading branch information...
commit f33ee69d59d2b06da3c3c1b24fc9bb640bf6ed25 1 parent 0bac4c7
@tenderlove tenderlove authored
View
17 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -190,16 +190,21 @@ def columns(table_name, name = nil) #:nodoc:
def indexes(table_name, name = nil) #:nodoc:
execute("PRAGMA index_list(#{quote_table_name(table_name)})", name).map do |row|
- index = IndexDefinition.new(table_name, row['name'])
- index.unique = row['unique'].to_i != 0
- index.columns = execute("PRAGMA index_info('#{index.name}')").map { |col| col['name'] }
- index
+ IndexDefinition.new(
+ table_name,
+ row['name'],
+ row['unique'].to_i != 0,
+ execute("PRAGMA index_info('#{row['name']}')").map { |col|
+ col['name']
+ })
end
end
def primary_key(table_name) #:nodoc:
- column = table_structure(table_name).find {|field| field['pk'].to_i == 1}
- column ? column['name'] : nil
+ column = table_structure(table_name).find { |field|
+ field['pk'].to_i == 1
+ }
+ column && column['name']
end
def remove_index!(table_name, index_name) #:nodoc:
Please sign in to comment.
Something went wrong with that request. Please try again.