@@ -1162,19 +1162,6 @@ def table_exists?(name)
11621162 end
11631163 end
11641164
1165- # @private
1166- IndexDefinition = ::ActiveRecord ::ConnectionAdapters ::IndexDefinition
1167- if ActiveRecord ::VERSION ::MAJOR < 3 ||
1168- ( ActiveRecord ::VERSION ::MAJOR == 3 && ActiveRecord ::VERSION ::MINOR <= 1 )
1169- # NOTE: make sure we accept 6 arguments (>= 3.2) as well as 5 (<= 3.1) :
1170- # allow 6 on 3.1 : Struct.new(:table, :name, :unique, :columns, :lengths)
1171- IndexDefinition . class_eval do
1172- def initialize ( table , name , unique = nil , columns = nil , lengths = nil , orders = nil )
1173- super ( table , name , unique , columns , lengths ) # @see {#indexes}
1174- end
1175- end
1176- end
1177-
11781165 def index_name_exists? ( table_name , index_name , default )
11791166 exec_query ( <<-SQL , 'SCHEMA' ) . rows . first [ 0 ] . to_i > 0
11801167 SELECT COUNT(*)
@@ -1188,6 +1175,9 @@ def index_name_exists?(table_name, index_name, default)
11881175 SQL
11891176 end if AR42_COMPAT
11901177
1178+ # @private
1179+ IndexDefinition = ::ActiveRecord ::ConnectionAdapters ::IndexDefinition
1180+
11911181 # Returns an array of indexes for the given table.
11921182 def indexes ( table_name , name = nil )
11931183 # NOTE: maybe it's better to leave things of to the JDBC API ?!
@@ -1232,7 +1222,7 @@ def indexes(table_name, name = nil)
12321222
12331223 IndexDefinition . new ( table_name , index_name , unique , column_names , [ ] , orders , where , nil , using )
12341224 else
1235- IndexDefinition . new ( table_name , index_name , unique , column_names , [ ] , orders )
1225+ new_index_definition ( table_name , index_name , unique , column_names , [ ] , orders )
12361226 end
12371227 end
12381228 end
0 commit comments