use our own index def class for better compatibility across ActiveRecord versions

This commit is contained in:
Brian Lopez 2010-10-27 15:36:25 -07:00
parent 426cff8adc
commit 90ddb63e52

View File

@ -18,6 +18,9 @@ module ActiveRecord
end
module ConnectionAdapters
class Mysql2IndexDefinition < Struct.new(:table, :name, :unique, :columns, :lengths) #:nodoc:
end
class Mysql2Column < Column
BOOL = "tinyint(1)"
def extract_default(default)
@ -447,7 +450,7 @@ module ActiveRecord
if current_index != row[:Key_name]
next if row[:Key_name] == PRIMARY # skip the primary key
current_index = row[:Key_name]
indexes << IndexDefinition.new(row[:Table], row[:Key_name], row[:Non_unique] == 0, [], [])
indexes << Mysql2IndexDefinition.new(row[:Table], row[:Key_name], row[:Non_unique] == 0, [], [])
end
indexes.last.columns << row[:Column_name]