TIL in Rails: How to change column defaults with :from and :to option for making it a reversible migration
by @rinas
I was trying to change a column default
def change change_column_default :blog, :language, "en_US" end
and it gave this error when I try to rollback the migration
Caused by: ActiveRecord::IrreversibleMigration: change_column_default is only reversible if given a :from and :to optio
Learned that we can pass :from and :to option there.
SOLUTION:
SOLUTION:
def change change_column_default :blog, :language, from: "en", to: "en_US" end