This seems to have been asked before: rails decimal precision and scale
But when running a change_column
migration for :precision
or :scale
they don't actually affect the schema or database, but db:migrate
runs without errors.
My migration file looks like this:
class ChangePrecisionAndScaleOfPaybackPeriodInTags < ActiveRecord::Migration
def self.up
change_column :tags, :payback_period, :decimal, { :scale => 3, :precision => 10 }
end
def self.down
change_column :tags, :payback_period, :decimal
end
end
But my schema (and the data) remains as:
t.decimal "payback_period"
Anybody else have this issue?
Thanks,
Josh
Had a related (but not same) problem. I was just changing scale, so when changing the :scale you need the full line:
change_column :something, :weight, :decimal, :precision => 10, :scale => 2
omitting :decimal (which it already was) and :precision (which already was 10) will cause the migration to fail.