From 90ddb63e52cd48c1a1b46acb41cb66552a781f34 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Wed, 27 Oct 2010 15:36:25 -0700 Subject: [PATCH] use our own index def class for better compatibility across ActiveRecord versions --- lib/active_record/connection_adapters/mysql2_adapter.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/active_record/connection_adapters/mysql2_adapter.rb index 828e948..1e004f3 100644 --- a/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -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]