Forum: Ruby on Rails patch - mysql double datatype

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
jzimmek (Guest)
on 2009-01-19 13:28
(Received via mailing list)
while porting some parts of our java-based plattform to rails i
encounter some problems while using migrations and db:schema:dump. the
database schema uses several "double" column types which are not
supported natively in activerecord ... as far as i know ... and i
cannot change the database schema.

from some blogs i know that "t.float :mycolumn :limit => 53" results
in a generated column of type double.

this solved 50% of my problem, but running a "rake db:schema:dump"
ignores the "limit 53" which will generate an invalid schema on next
run of "rake db:schema:load".

i think if found the relevant part in the mysql_adapter.rb to patch
this, but it would be great if some more experienced rails people
could confirm this.


*** mysql_adapter.orig.rb       2009-01-19 12:09:58.000000000 +0100
--- mysql_adapter.rb    2009-01-19 11:59:18.000000000 +0100
*** 116,121 ****
--- 116,122 ----
                super # we could return 65535 here, but we leave it
undecorated by default
+           when /^double/i;    53
            when /^bigint/i;    8
            when /^int/i;       4
            when /^mediumint/i; 3
*** 504,509 ****
--- 505,511 ----
          when 3; 'mediumint'
          when nil, 4, 11; 'int(11)'  # compatibility with MySQL
          when 5..8; 'bigint'
+         when 53; 'double'
          else raise(ActiveRecordError, "No integer type has byte size
This topic is locked and can not be replied to.