Browsing the activerecord-2.1.0 source code I found the following:
case limit
when 0..3
"smallint(#{limit})"
when 4..8
"int(#{limit})"
when 9..20
"bigint(#{limit})"
else
'int(11)'
end
The mysql adapter of activerecord is now able to use more appropriate
data types for integers! Finally! That’s awesome!
However, where is the mediumint data type? Numbers with length of 5 and
6 should be stored as a mediumint in order to obtain optimal performance
from mysql.
Shouldn’t this be fixed somehow? I’m considering applying a patch myself
(however, I don’t know how yet), but I thought I’d hear you guys out
first…