Specify length / decimal places in a migration?

Is it possible to specify the length and number of decimal places for a
float in a migration? I using MySQL and can do it through the GUI
client, but can’t Google up anything on doing it in a migration.

Thanks,
Bill

You should use decimal instead of float.

t.column :name, :decimal, :precision => 10, :scale => 2

This will give you numbers as 00000000.00, for example (10 digits, 2
digits right of decimal point).

Regards,
Jorge Corona.

Hi Jorge,

Pozole wrote:

You should use decimal instead of float.

t.column :name, :decimal, :precision => 10, :scale => 2

Perfect. Thanks much!

Best regards,
Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs