rails decimal precision and scale

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.

Answer1:

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

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

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:rails decimal precision and scale