Flowdock
method

initialize_type_map

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: AbstractMysqlAdapter
initialize_type_map(m = type_map) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 565
        def initialize_type_map(m = type_map)
          super

          m.register_type(%(char)) do |sql_type|
            limit = extract_limit(sql_type)
            Type.lookup(:string, adapter: :mysql2, limit: limit)
          end

          m.register_type %(tinytext),   Type::Text.new(limit: 2**8 - 1)
          m.register_type %(tinyblob),   Type::Binary.new(limit: 2**8 - 1)
          m.register_type %(text),       Type::Text.new(limit: 2**16 - 1)
          m.register_type %(blob),       Type::Binary.new(limit: 2**16 - 1)
          m.register_type %(mediumtext), Type::Text.new(limit: 2**24 - 1)
          m.register_type %(mediumblob), Type::Binary.new(limit: 2**24 - 1)
          m.register_type %(longtext),   Type::Text.new(limit: 2**32 - 1)
          m.register_type %(longblob),   Type::Binary.new(limit: 2**32 - 1)
          m.register_type %(^float),     Type::Float.new(limit: 24)
          m.register_type %(^double),    Type::Float.new(limit: 53)

          register_integer_type m, %(^bigint),    limit: 8
          register_integer_type m, %(^int),       limit: 4
          register_integer_type m, %(^mediumint), limit: 3
          register_integer_type m, %(^smallint),  limit: 2
          register_integer_type m, %(^tinyint),   limit: 1

          m.register_type %(^tinyint\(1\)), Type::Boolean.new if emulate_booleans
          m.alias_type %(year), "integer"
          m.alias_type %(bit),  "binary"

          m.register_type %(^enum), Type.lookup(:string, adapter: :mysql2)
          m.register_type %(^set),  Type.lookup(:string, adapter: :mysql2)
        end
Register or log in to add new notes.