# Schema.rb and MySQL decimal

**URL:** <https://www.ruby-forum.com/t/schema-rb-and-mysql-decimal/57474>\
**Category:** Rails\
**Created:** [April 11, 2006, 10:55am UTC](https://www.ruby-forum.com/t/schema-rb-and-mysql-decimal/57474 "2006-04-11T10:55:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![meckart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@meckart](https://www.ruby-forum.com/u/meckart)\
**Post date:** [April 11, 2006, 10:55am UTC](https://www.ruby-forum.com/t/schema-rb-and-mysql-decimal/57474/1 "2006-04-11T10:55:10Z")

</div>

Hi,

I have a mysql schema with some decimal(20,20) fields. Now, I made a  
rake db\_schema\_dump for deployment of my applications on other machines.  
Rails created a schema.rb with the decimal fields as float.  
After a rake db\_schema\_import the fields are just float not decimal. How  
can I force rails to create decimal(20,20) columns instead of float?

Thx.  
Marc

---

<div class="post-metadata">

**Author:** ![meckart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@meckart](https://www.ruby-forum.com/u/meckart)\
**Post date:** [April 12, 2006, 2:22pm UTC](https://www.ruby-forum.com/t/schema-rb-and-mysql-decimal/57474/2 "2006-04-12T14:22:34Z")

</div>

On Tuesday 11 April 2006 09:55, Marc Eckart wrote:

> Hi,
> 
> I have a mysql schema with some decimal(20,20) fields. Now, I made a  
> rake db\_schema\_dump for deployment of my applications on other machines.  
> Rails created a schema.rb with the decimal fields as float.  
> After a rake db\_schema\_import the fields are just float not decimal. How  
> can I force rails to create decimal(20,20) columns instead of float?
> 
> Thx.  
> Marc

Marc,

This is what I’ve been working on in a decimals patch:  
[http://dev.rubyonrails.org/ticket/4274](http://dev.rubyonrails.org/ticket/4274)

See my recent post re decimal support, as there is an issue with the  
schema  
dumper where you will get decimal rather than decimal(20,20) but this is  
a 2  
line fix I might even do tonight.

Ashley

---

<div class="post-metadata">

**Author:** ![meckart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@meckart](https://www.ruby-forum.com/u/meckart)\
**Post date:** [April 26, 2006, 12:12pm UTC](https://www.ruby-forum.com/t/schema-rb-and-mysql-decimal/57474/3 "2006-04-26T12:12:11Z")

</div>

So what’s the status on this? Will we be able to create decimal columns  
from  
a schema.rb any time soon? I have tests failing because I originially  
created my DB with a SQL file, but when it goes to test the decimals are  
set  
to floats…
