Sha256: 2b65d23be5bd27f9524a04d4050cf9258d85b7d36d0b96db6c4b42690e19f46c

Contents?: true

Size: 685 Bytes

Versions: 12

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

require 'rom/sql/schema/attributes_inferrer'

module ROM
  module SQL
    module MySQL
      class TypeBuilder < Schema::TypeBuilder
        defines :db_type_mapping

        db_type_mapping(
          'tinytext' => Types::String,
          'text' => Types::String,
          'mediumtext' => Types::String,
          'longtext' => Types::String
        ).freeze

        def map_type(ruby_type, db_type, **_)
          map_db_type(db_type) || super
        end

        def map_db_type(db_type)
          self.class.db_type_mapping[db_type]
        end
      end
    end

    Schema::TypeBuilder.register(:mysql, MySQL::TypeBuilder.new.freeze)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rom-sql-3.6.4 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.6.3 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.6.2 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.6.1 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.6.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.5.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.4.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.3.3 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.3.2 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.3.1 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.3.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.2.0 lib/rom/sql/extensions/mysql/type_builder.rb