Question

I have about 30 tables in a rails app and there are about 6 tables for which I would like to change the precision and scale of some of the decimal columns. How do you go about doing that for already existing columns? Do you need to do each new migration separately, or can they all be done at once.

Was it helpful?

Solution

change_column :table_name, :column_name, :type
will update the column's type.

Ref: http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/change_column

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top