@@ -41,8 +41,26 @@ def jdbc_connection_class
4141 def new_client ( conn_params , adapter_instance )
4242 jdbc_connection_class . new ( conn_params , adapter_instance )
4343 end
44+
45+ private
46+ def initialize_type_map ( m )
47+ super
48+
49+ m . register_type ( %r(char)i ) do |sql_type |
50+ limit = extract_limit ( sql_type )
51+ Type . lookup ( :string , adapter : :mysql2 , limit : limit )
52+ end
53+
54+ m . register_type %r(^enum)i , Type . lookup ( :string , adapter : :mysql2 )
55+ m . register_type %r(^set)i , Type . lookup ( :string , adapter : :mysql2 )
56+ end
4457 end
4558
59+ # NOTE: redefines constant defined in abstract class however this time
60+ # will use methods defined in the mysql abstract class and map properly
61+ # mysql types.
62+ TYPE_MAP = Type ::TypeMap . new . tap { |m | initialize_type_map ( m ) }
63+
4664 def initialize ( ...)
4765 super
4866
@@ -58,11 +76,6 @@ def initialize(...)
5876 @connection_parameters ||= @config
5977 end
6078
61- # NOTE: redefines constant defined in abstract class however this time
62- # will use methods defined in the mysql abstract class and map properly
63- # mysql types.
64- TYPE_MAP = Type ::TypeMap . new . tap { |m | initialize_type_map ( m ) }
65-
6679 def self . database_exists? ( config )
6780 conn = ActiveRecord ::Base . mysql2_connection ( config )
6881 conn && conn . really_valid?
0 commit comments