This project is archived and is in readonly mode.
mysql adapter with mediumt support
-
Rasmus
- No changes were found…
-
Pratik
- State changed from new to invalid
- Tag set to 2.1, activerecord, enhancement, mysql, patch
Is this still an issue with Edge rails ? I see mysql_adapter already seems to be having support for medium int.
Thanks.
-
Rasmus
Thank you for your reply.
Jeremy Kemper added mediumint here:
http://github.com/rails/rails/co...
However, I'm personally not sure he has done everything correct.
Example (taken from jeremy's commit):
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
For instance, doesn't this mean that rails will choose mediumint as data type for storing integers with a length of 3? That should be smallint! Smallint holds (if signed) -32768 to 32767 so it would easy hold an integer with length of 3 and even 4. Using mediumint here just wastes disk space and increase mysql memory consumption without any reason.
As I understand rails and mysql data types, it should rather be something like:
when 0..2; 'tinyint'
when 2..4; 'smallint'
when 5..6; 'mediumint'
when 7..9; 'int'
when 9..20; 'bigint'
Or am I missing something here?
-
Pratik
- Assigned user set to Jeremy Kemper
I'm not sure to be honest. But you should probably send an email to rails core mailing list - http://groups.google.com/group/r...
Thanks.