I am using Rails 3.0.3 (I do not ask), and when I start the migration for a table with a decimal column and set: default => 0, it again sets the column scale and precision (10.0).
def self.up
create_table :courses do |t|
t.integer :user_id
t.string :name
t.decimal :distance, :precision => 5, :scale => 2, :default => 0
t.text :notes
t.timestamps
end
end
When I remove the parameter: default => 0 from the migration, the column scaling and precision are correct: (5.2)
I tried to migrate change_column with only the setting: default =>: 0, but the scale and accuracy of the column were reset to (10.0)
change_column :courses, :distance, :decimal, :default => 0.0
I know that I can go into MySQL and correct the accuracy and scale of the column, but I wonder if I am doing something wrong or if this is an error?
Google does not disclose any information, so I think I'm doing something wrong.