mardi 19 juillet 2016

Does rename_column in Rails ActiveRecord Migration preserve the old column data type?

I am trying to run a rails migration where in I am changing just the column name. So, this rails takes care of keeping the same data type as the old column or tries to make a guess based on the column content?

def change
   rename_column :marks, :percent, :percentage
end

The old type was decimal and after migration it still remains decimal. Just I wanted to know the type was preserved because the existing values were decimal or it was because of the old data type.

Aucun commentaire:

Enregistrer un commentaire