Thursday, December 28, 2006

Mysql Decimal Precisin Scale - Doesn't work

In Rails Migration scripts if a table column is defined as
t.column :my_decimal_column, :decimal, :precision =>8, :scale =>2, :default =>0.00, it would result with a column decimal(10,0) in Mysql db. The problem is with the current stable rails. With Edgerails, it will work.

Visit EdgeRails at http://wiki.rubyonrails.com/rails/pages/EdgeRails

A work aroung for this could be, in your migration script use:

execute "alter table my_table modify column my_decimal_column decimal(8,2)" instead.

No comments: