# migration with decimal problem (mysql)

**URL:** <https://discuss.rubyonrails.org/t/migration-with-decimal-problem-mysql/681>\
**Category:** rubyonrails-talk\
**Created:** [August 29, 2006, 1:53am UTC](https://discuss.rubyonrails.org/t/migration-with-decimal-problem-mysql/681 "2006-08-29T01:53:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Michaux](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@Peter\_Michaux](https://discuss.rubyonrails.org/u/Peter_Michaux)\
**Post date:** [August 29, 2006, 1:53am UTC](https://discuss.rubyonrails.org/t/migration-with-decimal-problem-mysql/681/1 "2006-08-29T01:53:54Z")

</div>

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| &nbsp;&nbsp;t.column :name, :string &nbsp;&nbsp;t.column :stars, :decimal, :precision=\>4, :scale=\>3 end

produces

---

<div class="post-metadata">

**Author:** ![Dave\_Thomas](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@Dave\_Thomas](https://discuss.rubyonrails.org/u/Dave_Thomas)\
**Post date:** [August 29, 2006, 2:16am UTC](https://discuss.rubyonrails.org/t/migration-with-decimal-problem-mysql/681/2 "2006-08-29T02:16:20Z")

</div>

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

Dave

---

<div class="post-metadata">

**Author:** ![Daniel\_Higginbotham](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@Daniel\_Higginbotham](https://discuss.rubyonrails.org/u/Daniel_Higginbotham)\
**Post date:** [August 29, 2006, 2:18am UTC](https://discuss.rubyonrails.org/t/migration-with-decimal-problem-mysql/681/3 "2006-08-29T02:18:49Z")

</div>

From

> **[ActiveRecord::ConnectionAdapters::TableDefinition](https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#M000569)**
>
> Represents the schema of an SQL table in an abstract way. This class provides methods for manipulating the schema representation.

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
