Forum: Ruby on Rails patch - mysql double datatype

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C22c46a54673d3f35910b1a4199ee80f?d=identicon&s=25 jzimmek (Guest)
on 2009-01-19 12: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.


regards
jan


*** 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 ----
              else
                super # we could return 65535 here, but we leave it
undecorated by default
              end
+           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
default
          when 5..8; 'bigint'
+         when 53; 'double'
          else raise(ActiveRecordError, "No integer type has byte size
#{limit}")
          end
        end
This topic is locked and can not be replied to.