What is Rails' migration equivalent to MySQL's 'double' datatype?

In my case (for test-db preparation):

MySQL (with mysql2(0.3.11) driver):

double(64,12)

Rails (in db/schema.rb):

   t.float :limit=>64                    ==> failed
   t.float :limit=>53                    ==> occasionally succeeded
   t.decimal :precision=>64, :scale=>12  ==> fully succeeded

There's no specific type for double, Rails tries to be smart about it:

The numeric (integer/decimal/float) column definitions use the :limit option for the number of bytes in an integer column type, and the :scale/:precision options for floats.

(precision is the number of significant digits; scale is how many of these fall after the decimal point.)


You can get Rails to create a DOUBLE. I'm not sure how "officially" supported the following solution is, but it works for MySQL. Just set the limit to 53. e.g.:

t.float :published_at, :limit => 53, :null => true

I got the answer from this blog post and there is some more testing results regarding this there.