Sha256: 74bd22d9edbf0bc19d9bd76e6f1e58e3677a54e24b7deb5395d83942b3284f22

Contents?: true

Size: 654 Bytes

Versions: 12

Compression:

Stored size: 654 Bytes

Contents

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.1.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.0.1 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-3.0.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.5.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.4.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.3.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.2.1 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.2.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.1.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.0.0 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.0.0.rc1 lib/rom/sql/extensions/mysql/type_builder.rb
rom-sql-2.0.0.beta3 lib/rom/sql/extensions/mysql/type_builder.rb