activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
        case type.to_s
        when 'binary'
          case limit
          when 0..0xfff;           "varbinary(#{limit})"
          when nil;                "blob"
          when 0x1000..0xffffffff; "blob(#{limit})"
          else raise(ActiveRecordError, "No binary type has character length #{limit}")
          end
        when 'integer'
          case limit
          when 1; 'tinyint'
          when 2; 'smallint'
          when 3; 'mediumint'
          when nil, 4, 11; 'int(11)'  # compatibility with MySQL default
          when 5..8; 'bigint'
          else raise(ActiveRecordError, "No integer type has byte size #{limit}")
          end
        when 'text'
          case limit
          when 0..0xff;               'tinytext'
          when nil, 0x100..0xffff;    'text'
          when 0x10000..0xffffff;     'mediumtext'
          when 0x1000000..0xffffffff; 'longtext'
          else raise(ActiveRecordError, "No text type has character length #{limit}")
          end
        else
          super
        end
      end
# Maps logical Rails types to MySQL-specific data types.
Maps logical Rails types to MySQL-specific data types.
Maps logical Rails types to MySQL - specific data types .
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
        case type.to_s
        when 'binary'
          case limit
          when 0..0xfff;           "varbinary(#{limit})"
          when nil;                "blob"
          when 0x1000..0xffffffff; "blob(#{limit})"
          else raise(ActiveRecordError, "No binary type has character length #{limit}")
          end
        when 'integer'
          case limit
          when 1; 'tinyint'
          when 2; 'smallint'
          when 3; 'mediumint'
          when nil, 4, 11; 'int(11)'  
          when 5..8; 'bigint'
          else raise(ActiveRecordError, "No integer type has byte size #{limit}")
          end
        when 'text'
          case limit
          when 0..0xff;               'tinytext'
          when nil, 0x100..0xffff;    'text'
          when 0x10000..0xffffff;     'mediumtext'
          when 0x1000000..0xffffffff; 'longtext'
          else raise(ActiveRecordError, "No text type has character length #{limit}")
          end
        else
          super
        end
      end
def type_to_sql ( type , limit = nil , precision = nil , scale = nil ) case type . to_s when 'binary' case limit when 0 .. 0xfff ; "varbinary(#{limit})" when nil ; "blob" when 0x1000 .. 0xffffffff ; "blob(#{limit})" else raise ( ActiveRecordError , "No binary type has character length #{limit}" ) end when 'integer' case limit when 1 ; 'tinyint' when 2 ; 'smallint' when 3 ; 'mediumint' when nil , 4 , 11 ; 'int(11)' when 5 .. 8 ; 'bigint' else raise ( ActiveRecordError , "No integer type has byte size #{limit}" ) end when 'text' case limit when 0 .. 0xff ; 'tinytext' when nil , 0x100 .. 0xffff ; 'text' when 0x10000 .. 0xffffff ; 'mediumtext' when 0x1000000 .. 0xffffffff ; 'longtext' else raise ( ActiveRecordError , "No text type has character length #{limit}" ) end else super end end
Maps logical Rails types to MySQL-specific data types.
Maps logical Rails types to MySQL - specific data types .
# compatibility with MySQL default
type
limit
precision
scale