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.
Asked
Active
Viewed 3,339 times
1 Answers
3
change_column :table_name, :column_name, :type
will update the column's type.
Ref: http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/change_column

hgmnz
- 13,208
- 4
- 37
- 41
-
2If the :type isn't changing, just :precision and :scale, this does not work. – graywh Apr 13 '11 at 17:18