Migration with decimal problem (mysql)

Hi,

In the following migration I am trying to create a decimal column
called stars. After rake migrate you can see that the field does not
come out right in mysql. The decimal column has no decimal part. Does
anyone know what I am doing wrong or should be doing?

create_table :areas do |t|
t.column :name, :string
t.column :stars, :decimal, :precision=>4, :scale=>3
end

produces

±------------±--------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±------------±--------------±-----±----±--------±---------------+
| id | int(11) | | PRI | NULL | auto_increment |
| name | varchar(255) | YES | | NULL | |
| stars | decimal(10,0) | YES | | NULL | |
±------------±--------------±-----±----±--------±---------------+

I think that I’m hoping to see decimal(4,3)

Thanks,
Peter

On Aug 28, 2006, at 20:53, Peter M. wrote:

n the following migration I am trying to create a decimal column
called stars. After rake migrate you can see that the field does not
come out right in mysql. The decimal column has no decimal part. Does
anyone know what I am doing wrong or should be doing?

I’d guess you’re not on edge Rails.

Dave

From

it looks like migrations allow a :float type, and don’t allow you to set
precision or scale options. I’d try changing :decimal to :float and
leaving
in :precision and :scale to see what happens