File tree Expand file tree Collapse file tree 4 files changed +13
-1
lines changed
activerecord/lib/active_record Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -509,6 +509,10 @@ def combine_bind_parameters(
509509 result
510510 end
511511
512+ def default_index_type? ( index ) # :nodoc:
513+ index . using . nil?
514+ end
515+
512516 private
513517
514518 def initialize_type_map ( m )
Original file line number Diff line number Diff line change @@ -651,6 +651,10 @@ def valid_type?(type)
651651 !native_database_types [ type ] . nil?
652652 end
653653
654+ def default_index_type? ( index ) # :nodoc:
655+ index . using == :btree || super
656+ end
657+
654658 private
655659
656660 def initialize_type_map ( m )
Original file line number Diff line number Diff line change @@ -402,6 +402,10 @@ def postgresql_version
402402 @connection . server_version
403403 end
404404
405+ def default_index_type? ( index ) # :nodoc:
406+ index . using == :btree || super
407+ end
408+
405409 private
406410
407411 # See http://www.postgresql.org/docs/current/static/errcodes-appendix.html
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ def index_parts(index)
188188 index_parts << "length: { #{ format_options ( index . lengths ) } }" if index . lengths . present?
189189 index_parts << "order: { #{ format_options ( index . orders ) } }" if index . orders . present?
190190 index_parts << "where: #{ index . where . inspect } " if index . where
191- index_parts << "using: #{ index . using . inspect } " if index . using && index . using != :btree
191+ index_parts << "using: #{ index . using . inspect } " if ! @connection . default_index_type? ( index )
192192 index_parts << "type: #{ index . type . inspect } " if index . type
193193 index_parts << "comment: #{ index . comment . inspect } " if index . comment
194194 index_parts
You can’t perform that action at this time.
0 commit comments